[php-src] PR #21573: Fix GH-20112: Fatal error during autoloading of complex inheritance chain
| From: | iliaal | Date: | Sun, 29 Mar 2026 18:38:59 +0000 |
| Subject: | [php-src] PR #21573: Fix GH-20112: Fatal error during autoloading of complex inheritance chain | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-35432@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/21573
Author: iliaal
Fixes #20112
load_delayed_classes() iterates a shared CG(delayed_autoloads) hash table.
When autoloading triggers linking of another class with unresolved variance, the recursive call
walks the same table and can pull entries that belong to an outer caller. If that entry's
parent is still mid-linking up the call stack, the load hits a fatal error.
The fix adds a nesting depth counter. At depth > 1, if a class doesn't load and isn't
in the class table, we catch the exception and re-append the entry for the outer caller to pick up
once its dependency chain completes. A consecutive-failure count breaks out when no progress is
possible. At depth 1, failures propagate as before.
Targeting 8.4 since the bug has existed since PHP 8.1 (bisected to a38f4f98). No performance impact;
the new code only runs on the exception path.