mirror of
https://github.com/php/php-src.git
synced 2025-01-12 05:54:13 +08:00
39 lines
573 B
PHP
39 lines
573 B
PHP
--TEST--
|
|
Bug #71202 (Autoload function registered by another not activated immediately)
|
|
--FILE--
|
|
<?php
|
|
|
|
function inner_autoload ($name){
|
|
if ($name == 'A') {
|
|
class A {
|
|
function __construct(){
|
|
echo "okey, ";
|
|
}
|
|
}
|
|
} else {
|
|
class B {
|
|
function __construct() {
|
|
die("error");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
spl_autoload_register(function ($name) {
|
|
if ($name == 'A') {
|
|
spl_autoload_register("inner_autoload");
|
|
} else {
|
|
spl_autoload_unregister("inner_autoload");
|
|
}
|
|
});
|
|
|
|
$c = new A();
|
|
try {
|
|
$c = new B();
|
|
} catch (Error $e) {
|
|
echo "done";
|
|
}
|
|
?>
|
|
--EXPECT--
|
|
okey, done
|