mirror of
https://github.com/php/php-src.git
synced 2025-01-12 05:54:13 +08:00
bc2ff4a299
It makes no sense that you can't write a closure using $this in a static method, even though you can write one outside a class. Now only closures that have been marked as static will be considered to be static. Fixes bug #65598.
19 lines
247 B
PHP
19 lines
247 B
PHP
--TEST--
|
|
Closure 045: Closures created in static methods are not implicitly static
|
|
--FILE--
|
|
<?php
|
|
|
|
class A {
|
|
static function foo() {
|
|
return function () {};
|
|
}
|
|
}
|
|
|
|
$a = A::foo();
|
|
$a->bindTo(new A);
|
|
|
|
echo "Done.\n";
|
|
|
|
--EXPECTF--
|
|
Done.
|