mirror of
https://github.com/php/php-src.git
synced 2024-12-02 22:34:55 +08:00
38 lines
573 B
PHP
38 lines
573 B
PHP
--TEST--
|
|
Bug #66811: Cannot access static::class in lambda, written outside of a class
|
|
--FILE--
|
|
<?php
|
|
class A {
|
|
public static function f() {
|
|
return function () {
|
|
var_dump(self::class);
|
|
var_dump(static::class);
|
|
};
|
|
}
|
|
}
|
|
|
|
class B extends A {}
|
|
|
|
$f = B::f();
|
|
$f();
|
|
|
|
$g = $f->bindTo(null, A::class);
|
|
$g();
|
|
|
|
$foo = function () {
|
|
var_dump(self::class);
|
|
var_dump(static::class);
|
|
};
|
|
|
|
$bar = $foo->bindTo(null, A::class);
|
|
$bar();
|
|
|
|
?>
|
|
--EXPECT--
|
|
string(1) "A"
|
|
string(1) "B"
|
|
string(1) "A"
|
|
string(1) "A"
|
|
string(1) "A"
|
|
string(1) "A"
|