[php-src] Issue #8063: Opcache breaks autoloading after E_COMPILE_ERROR

From: Date: Tue, 08 Feb 2022 20:33:43 +0000
Subject: [php-src] Issue #8063: Opcache breaks autoloading after E_COMPILE_ERROR
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-239560@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/8063 Author: ShiraNai7 ### Description If an E_COMPILE_ERROR is raised during autoloading with opcache enabled, it breaks autoloading during the shutdown process in subsequent requests. Multiple files are required to reproduce this, so I've put them in this gist: https://gist.github.com/ShiraNai7/d2077e5581ce5ec53c655c7373846147 With opcache enabled, the script works once, then it always fatals twice. Without opcache it always works as expected. ```php <?php spl_autoload_register(function (string $name) { echo "Autoloading: {$name}<br>\n"; require __DIR__ . '/' . $name . '.php'; }); register_shutdown_function(function () { new Bar(); // this triggers E_COMPILE_ERROR again for BadClass (???) new Baz(); echo "Finished<br>\n"; }); new BadClass(); // this triggers E_COMPILE_ERROR ``` Resulted in this output: ``` Autoloading: BadClass Autoloading: Foo Fatal error: Declaration of BadClass::dummy() must be compatible with Foo::dummy(): void in /var/www/html/BadClass.php on line 5 Autoloading: Bar Fatal error: Declaration of BadClass::dummy() must be compatible with Foo::dummy(): void in /var/www/html/BadClass.php on line 5 ``` But I expected this output instead: ``` Autoloading: BadClass Autoloading: Foo Fatal error: Declaration of BadClass::dummy() must be compatible with Foo::dummy(): void in /var/www/html/BadClass.php on line 5 Autoloading: Bar Autoloading: Baz Finished ``` ### PHP Version 8.1.2 ### Operating System Debian 11.2

« previous php.bugs (#239560) next »