php-src/Zend/tests/nested_method_and_function.phpt
Nikita Popov 9364153942 Fixed bug #76430
It's somewhat ambiguous what exactly the correct behavior is
supposed to be, I'm just picking something more or less reasonable
here.
2019-02-12 17:36:07 +01:00

40 lines
691 B
PHP

--TEST--
active_class_entry must be always correct (__METHOD__ should not depend on declaring function ce)
--FILE--
<?php
namespace Baz;
class Foo {
public static function bar() {
function foo() {
var_dump(__FUNCTION__);
var_dump(__METHOD__);
var_dump(__CLASS__);
}
foo();
var_dump(__FUNCTION__);
var_dump(__METHOD__);
var_dump(__CLASS__);
return function() {var_dump(__FUNCTION__); var_dump(__METHOD__); var_dump(__CLASS__); };
}
}
$c = Foo::bar();
$c();
?>
--EXPECT--
string(7) "Baz\foo"
string(7) "Baz\foo"
string(0) ""
string(3) "bar"
string(12) "Baz\Foo::bar"
string(7) "Baz\Foo"
string(13) "Baz\{closure}"
string(13) "Baz\{closure}"
string(7) "Baz\Foo"