mirror of
https://github.com/php/php-src.git
synced 2024-12-19 15:00:15 +08:00
ab97606b8a
* Don't throw an error if self/parent/static are used in a closure (outside a class). * Don't propagate self:: constants into closures * Use runtime fetch for self::class in closures Fixes bug #66811.
26 lines
367 B
PHP
26 lines
367 B
PHP
--TEST--
|
|
self:: class constants should not be propagated into closures, due to scope rebinding
|
|
--FILE--
|
|
<?php
|
|
|
|
class A {
|
|
const C = 'A::C';
|
|
|
|
public function f() {
|
|
return function() {
|
|
return self::C;
|
|
};
|
|
}
|
|
}
|
|
|
|
class B {
|
|
const C = 'B::C';
|
|
}
|
|
|
|
$f = (new A)->f();
|
|
var_dump($f->bindTo(null, 'B')());
|
|
|
|
?>
|
|
--EXPECT--
|
|
string(4) "B::C"
|