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
120
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
Transcript
12 slides
「値はあるのに空判定」される怪奇現象を 追ったら、犯人は __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
ご清聴ありがとうございました!
More Decks by にわ
See All by にわ
php-fpmのプロセスが枯渇した日-調査・対処・そして本当にやるべきだったこと-
shibuchaaaan
0
580
Other Decks in Programming
See All in Programming
AIが実装を担う時代の「技術設計」と「チームマネジメント」
kamina_zzz
2
410
AI時代のFlutter品質設計 — アプリ品質を守るQuality Layers
omatty198
0
390
止まらない比較を止める — 余帰納法で無限ストリームを比べる
tarao
0
210
protojson における文字化けの扱い
kazuki1023
0
460
AIが生成したコードは読むべきか?抽象化設計とコードの品質保証 / abstraction-design-and-quality
minodriven
17
9.5k
AIがコードを書いてくれる時代、我々は何を確かめるのか
yosuke_furukawa
PRO
13
6.1k
読みやすい!と評判(?)の発表の準備にかける私のこだわり
shoheimitani
0
130
ビジネスロジックを堅牢に~Scala 3のドメインプリミティブ~
j5ik2o
0
220
Beyond Chatbots: Agentic UI with Open Standards @W-JAX 2026, München
manfredsteyer
PRO
0
130
複数ドメインを一つのアプリに統合するFlutterの設計と運用_FlutterKaigi2026登壇資料(須永高弘)
takahirosunaga
0
200
小さなアプリを作って公開するまで
onozaty
0
220
高橋メソッドでCVE解説シリーズ 〜CVE-2026-112816〜
hakkadaikon
0
270
Featured
See All Featured
Evolving SEO for Evolving Search Engines
ryanjones
0
370
How to Ace a Technical Interview
jacobian
280
24k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.7k
What the history of the web can teach us about the future of AI
inesmontani
PRO
3
830
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
670
Code Reviewing Like a Champion
maltzj
529
40k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.6k
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
1
250
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.4k
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.8k
Highjacked: Video Game Concept Design
rkendrick25
PRO
2
590
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
580