[php-src] PR #25778: Fix spl_autoload_register() accepting a Closure of spl_autoload_call()

From: Date: Thu, 26 Nov 2026 11:29:11 +0000
Subject: [php-src] PR #25778: Fix spl_autoload_register() accepting a Closure of spl_autoload_call()
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-41042@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/25778 Author: lacatoire spl_autoload_register() refuses spl_autoload_call by name by comparing the internal handler, but a Closure of an internal function has the handler of the Closure, so spl_autoload_register(spl_autoload_call(...)) is accepted and the next autoload recurses until the stack overflows (an assertion fails in a debug build of master). The Closure form now throws the same ValueError. ### To reproduce ```php <?php try { spl_autoload_register('spl_autoload_call'); } catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } spl_autoload_register(spl_autoload_call(...)); echo "registered\n"; var_dump(class_exists('Foo')); ``` Before (PHP 8.4.28): ``` ValueError: spl_autoload_register(): Argument #1 ($callback) must not be the spl_autoload_call() function registered Segmentation fault (core dumped) ``` After: ``` ValueError: spl_autoload_register(): Argument #1 ($callback) must not be the spl_autoload_call() function Fatal error: Uncaught ValueError: spl_autoload_register(): Argument #1 ($callback) must not be the spl_autoload_call() function ```

« previous php.git-pulls (#41042) next »