php-src/Zend/tests/call_user_func_closure_from_static_method.phpt
Nikita Popov 8f9f21e8d2 Fix static closure error in call_user_func opcode
I'm assuming this is the only error that is_callable() can generate
with retval=1.

This problem manifested after making closures in static methods
not implicitly static, but would also occur when binding any non-static
closure to a scope without a $this.
2015-05-08 15:17:15 +02:00

23 lines
389 B
PHP

--TEST--
call_user_func() on non-static closure without $this inside a static method
--FILE--
<?php
class A {
public static function exec(callable $c) {
return call_user_func($c);
}
public static function doSomething() {
return self::exec(function(){
return "okay";
});
}
}
var_dump(A::doSomething());
?>
--EXPECT--
string(4) "okay"