Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
「値はあるのに空判定」される怪奇現象を追ったら、犯人は __isset だった話 / PHPe...
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
にわ
March 23, 2026
Programming
39
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
「値はあるのに空判定」される怪奇現象を追ったら、犯人は __isset だった話 / PHPerKaigi 2026 ルーキーズLT
プロポーザル:
https://fortee.jp/phperkaigi-2026/proposal/5417d2ae-f878-443c-9b39-79f1a1f7de92
にわ
March 23, 2026
Other Decks in Programming
See All in Programming
その問い、本当に正しいですか?AI時代のエンジニアに必要な哲学と認知科学 / ai-philosophy-cognitive-science
minodriven
4
1.4k
These Five Tricks Can Make Your Apps Greener, Cheaper, & Nicer
hollycummins
0
280
「AIで開発し、AIを届ける」をEvalでつなぐ 〜AIネイティブに始めるプロダクト開発の実践〜 / Connecting "Develop with AI, deliver AI" with Eval
rkaga
4
4.8k
軽量Java基盤の設計 DIコンテナに頼らない、長期保守と1秒起動の実現 JJUG CCC 2026 Spring
macha64
0
480
Claspは野良GASの夢をみるか
takter00
0
180
AutonomyとControlのあいだ:Graflowで記述するAIエージェント協調
myui
0
110
フロントエンドとバックエンドで「1文字」を揃えよう
youkidearitai
PRO
0
230
AIエージェントの隔離技術の徹底比較
kawayu
0
470
jQueryをバージョンアップする前に使いたいjQuery Migrate
matsuo_atsushi
0
200
Modding RubyKaigi for Myself
yui_knk
0
910
Hunting Vulnerabilities in Symfony with LLMs
vinceamstoutz
0
520
Observability in Practice:Grafana 與 Edge Device SRE 的那些事
blueswen
0
150
Featured
See All Featured
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.5k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
330
Unsuck your backbone
ammeep
672
58k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
310
My Coaching Mixtape
mlcsv
0
140
The untapped power of vector embeddings
frankvandijk
2
1.7k
Typedesign – Prime Four
hannesfritz
42
3.1k
Amusing Abliteration
ianozsvald
1
200
Testing 201, or: Great Expectations
jmmastey
46
8.2k
Believing is Seeing
oripsolob
1
140
Build your cross-platform service in a week with App Engine
jlugia
234
18k
Transcript
「値はあるのに空判定」される怪奇現象を 追ったら、犯人は __isset() だった話 にわ
COPYRIGHT © EUSTYLE LABORATORY. ALL RIGHTS RESERVED. 自己紹介 • お酒、バンド、バイクが好き
• 不動産営業 ->SES ->ユースタイルラボラトリー株式会社 ◦ (ちょっと古い) 社内システム開発担当
COPYRIGHT © EUSTYLE LABORATORY. ALL RIGHTS RESERVED. 3
COPYRIGHT © EUSTYLE LABORATORY. ALL RIGHTS RESERVED. protectedプロパティに外部からアクセス 4 PHP:
オーバーロード - Manual
COPYRIGHT © EUSTYLE LABORATORY. ALL RIGHTS RESERVED. 事件発生! 5 true
値が入っているのに「空」判定!? 🤯
COPYRIGHT © EUSTYLE LABORATORY. ALL RIGHTS RESERVED. empty()のリファレンスもっかい見よう 6 isset()が無いのが怪しい!?
PHP: empty - Manual
COPYRIGHT © EUSTYLE LABORATORY. ALL RIGHTS RESERVED. 7
COPYRIGHT © EUSTYLE LABORATORY. ALL RIGHTS RESERVED. つまり、こういうこと 8 まず
__isset() で存在を確認し、 無いなら __get() を使うことなく「空」とみなす 「empty() は __get() を 直接呼ばない」
COPYRIGHT © EUSTYLE LABORATORY. ALL RIGHTS RESERVED. 今回の事象の解決策 9 __isset()
を実装 __get()と__isset()は セットで実装する public にする アクセス制御が不要なら 設計をシンプルに 明示的に比較 $obj->id !== 0 などで明⽰的に⽐較
COPYRIGHT © EUSTYLE LABORATORY. ALL RIGHTS RESERVED. まとめ 10 •
empty() はアクセス不能プロパティに対し、まず __isset() を確認する • __isset() が無いと __get() は呼ばれず、即「空」と判定される • __get() を書くなら __isset() も必ず書こう! マジックメソッドは 用法用量を守って正しくお使いください
COPYRIGHT © EUSTYLE LABORATORY. ALL RIGHTS RESERVED. ちなみに、 PHP8.1以降なら… 11
ご清聴ありがとうございました!