Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
「値はあるのに空判定」される怪奇現象を追ったら、犯人は __isset だった話 / PHPe...
Search
にわ
March 23, 2026
Programming
110
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
More Decks by にわ
See All by にわ
php-fpmのプロセスが枯渇した日-調査・対処・そして本当にやるべきだったこと-
shibuchaaaan
0
570
Other Decks in Programming
See All in Programming
Inertia Rails: The One-Person Framework with React & Friends
skryukov
0
170
AI時代のシニアエンジニアとは
yosuke_furukawa
PRO
12
11k
あなたの await、OS まで届いてる? strace で覗く JavaScript の非同期
hasutosasaki
1
1.6k
當我們開始不讀 Code - AI Agent 時代,Code Review 與 Clean Code 還剩下什麼?
jame2408
1
340
コードで差別化できない時代の ソフトウェアエンジニアリング / Software Engineering in an Era Where Code Doesn’t Differentiate
kishida
2
210
Agentic Software Factoryに、すごく賢いIF文を。 / super smart IF statement into the Agentic Software Factory.
rkaga
8
2.4k
Spec-Driven Development - Why Vaadin Is the Perfect Fit
simas
PRO
0
160
JIS keyboard support in Omarchy
lef237
0
170
Web Framework Benchmark Battle 2026, Any%
a_matsuda
3
3k
AI時代のTerminal環境を UNIX哲学で設計・運用する
yasunori0418
1
300
Unity6 URPによる海底をテーマにしたVJシステムの解説 | Unity Shader 完全に理解した 勉強会
gam0022
0
390
現場と育てるRailsモデリング 〜Spreadsheetから始めたモデル設計〜
siroemk
2
1.1k
Featured
See All Featured
AI Search: Where Are We & What Can We Do About It?
aleyda
0
8.1k
Ethics towards AI in product and experience design
skipperchong
2
440
Being A Developer After 40
akosma
PRO
92
590k
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.5k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
28
3.7k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
2
2.9k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
1k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
56k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
440
Building Adaptive Systems
keathley
44
3.3k
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
950
It's Worth the Effort
3n
188
29k
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
ご清聴ありがとうございました!