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

RFC: https://wiki.php.net/rfc/fcc_in_const_expr Co-authored-by: Volker Dusch <volker@tideways-gmbh.com>
31 lines
651 B
PHP
31 lines
651 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(16) "withStaticMethod"
|
|
}
|
|
Called AutoloadedClass::withStaticMethod
|