mirror of
https://github.com/php/php-src.git
synced 2024-11-23 18:04:36 +08:00
d9c2959c27
Closures will now use the called_scope from their instantiation site. If they are rebound either the class of $this is used or if no $this is provided the bound scope is used. With this change the scope for static closures can be changed back to use EG(scope) rather than EX(called_scope), thus fixing bug #69568.
26 lines
350 B
PHP
26 lines
350 B
PHP
--TEST--
|
|
Bug #69568: call a private function in closure failed
|
|
--FILE--
|
|
<?php
|
|
class A {
|
|
|
|
private static function testprivate() {
|
|
return 1;
|
|
}
|
|
public static function test() {
|
|
return function() {
|
|
return self::testprivate();
|
|
};
|
|
}
|
|
}
|
|
|
|
class B extends A {
|
|
}
|
|
|
|
$fn = B::test();
|
|
echo $fn();
|
|
|
|
?>
|
|
--EXPECT--
|
|
1
|