1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 16:22:37 +01:00
Files

32 lines
668 B
PHP

--TEST--
FCC in const expression triggers autoloader.
--FILE--
<?php
spl_autoload_register(static function ($class) {
echo "Autoloading {$class}", PHP_EOL;
eval(
<<<'EOT'
class AutoloadedClass {
public static function withStaticMethod() {
echo "Called ", __METHOD__, PHP_EOL;
}
}
EOT
);
});
const Closure = AutoloadedClass::withStaticMethod(...);
var_dump(Closure);
(Closure)();
?>
--EXPECTF--
Autoloading AutoloadedClass
object(Closure)#%d (1) {
["function"]=>
string(33) "AutoloadedClass::withStaticMethod"
}
Called AutoloadedClass::withStaticMethod