Commit d73b46e
committed
Fix GH-20112: Fatal error during autoloading of complex inheritance chain
When load_delayed_classes() is called recursively (e.g., autoloading a
class whose linking triggers another class with unresolved variance), the
shared delayed_autoloads table may contain entries from an outer caller
whose dependencies are not yet available. The inner call would attempt to
load these unrelated entries, causing a fatal error when their parent
class is still mid-linking higher up the call stack.
In nested calls, catch such loading failures and re-append the entry for
the outer caller to process later, when the dependency chain is complete.
A consecutive-failure counter ensures no infinite retry loops.
The nesting depth counter is kept as a file-local ZEND_TLS variable
rather than added to zend_compiler_globals, since PHP-8.4 forbids ABI
changes.
Closes GH-201121 parent b97dd33 commit d73b46e
2 files changed
Lines changed: 64 additions & 1 deletion
Lines changed: 41 additions & 0 deletions
| 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 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
| 38 | + | |
37 | 39 | | |
38 | 40 | | |
39 | 41 | | |
| |||
3280 | 3282 | | |
3281 | 3283 | | |
3282 | 3284 | | |
| 3285 | + | |
| 3286 | + | |
3283 | 3287 | | |
3284 | 3288 | | |
3285 | 3289 | | |
| |||
3288 | 3292 | | |
3289 | 3293 | | |
3290 | 3294 | | |
3291 | | - | |
3292 | 3295 | | |
| 3296 | + | |
| 3297 | + | |
| 3298 | + | |
| 3299 | + | |
| 3300 | + | |
| 3301 | + | |
| 3302 | + | |
| 3303 | + | |
| 3304 | + | |
| 3305 | + | |
| 3306 | + | |
| 3307 | + | |
| 3308 | + | |
| 3309 | + | |
| 3310 | + | |
| 3311 | + | |
3293 | 3312 | | |
3294 | 3313 | | |
3295 | 3314 | | |
3296 | 3315 | | |
| 3316 | + | |
| 3317 | + | |
3297 | 3318 | | |
| 3319 | + | |
3298 | 3320 | | |
3299 | 3321 | | |
3300 | 3322 | | |
| |||
0 commit comments