mirror of
https://github.com/php/php-src.git
synced 2025-08-18 06:58:55 +02:00

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.
18 lines
247 B
PHP
18 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.
|