mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00

We shouldn't try to load further classes if one autoload throws. This fixes oss-fuzz #38881, though I believe there are still two deeper issues here: 1) Why do we allow autoloading with an active exception? 2) Exception save & restore should probably also save and restore the exception opline.
31 lines
601 B
PHP
31 lines
601 B
PHP
--TEST--
|
|
Exception during delayed variance autoload
|
|
--FILE--
|
|
<?php
|
|
spl_autoload_register(function($class) {
|
|
echo "$class\n";
|
|
if ($class == 'X') {
|
|
new Y;
|
|
}
|
|
if ($class == 'Y') {
|
|
new Q;
|
|
}
|
|
});
|
|
class A {
|
|
function method(): X {}
|
|
}
|
|
class B extends A {
|
|
function method(): Y {}
|
|
}
|
|
?>
|
|
--EXPECTF--
|
|
Y
|
|
Q
|
|
|
|
Warning: Uncaught Error: Class "Q" not found in %s:%d
|
|
Stack trace:
|
|
#0 %s(%d): {closure}('Y')
|
|
#1 {main}
|
|
thrown in %s on line %d
|
|
|
|
Fatal error: Could not check compatibility between B::method(): Y and A::method(): X, because class Y is not available in %s on line %d
|