Commit fbf4a95
committed
Fix GH-20085: Assertion failure when combining lazy object get_properties exception with foreach loop
In this test, we will loop once, and then replace the object with an
instance that'll throw on property construction in Z_OBJPROP_P() in
the ZEND_FE_FETCH_RW VM handler.
Since at that point `pos >= fe_ht->nNumUsed`, we exit via
`fe_fetch_w_exit` without checking for an exception, causing incorrect
continuation of the code and an eventual assertion failure.
To solve this, we perform an exception check at the end of the
iteration. This should be sufficient to guarantee the exception is
checked in time as failure of get_properties() via Z_OBJPROP_P() will
always result in an empty hash table.
This should also be more efficient than the alternative fix that checks
for an exception right after Z_OBJPROP_P() as that would be executed at
each iteration.1 parent 2edb369 commit fbf4a95
File tree
3 files changed
+29
-2
lines changed- Zend
- tests/lazy_objects
3 files changed
+29
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7275 | 7275 | | |
7276 | 7276 | | |
7277 | 7277 | | |
7278 | | - | |
| 7278 | + | |
7279 | 7279 | | |
7280 | 7280 | | |
7281 | 7281 | | |
| |||
7371 | 7371 | | |
7372 | 7372 | | |
7373 | 7373 | | |
| 7374 | + | |
7374 | 7375 | | |
7375 | 7376 | | |
7376 | 7377 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments