diff options
author | Bob Weinand <bobwei9@hotmail.com> | 2015-10-05 17:49:32 +0200 |
---|---|---|
committer | Bob Weinand <bobwei9@hotmail.com> | 2015-10-05 17:49:32 +0200 |
commit | 35d0405c4790f0ce668c9e1b8b05197e55d29a05 (patch) | |
tree | fcb9d5fe2e447ba17f3ff81b19baaa989b2bf38c /Zend/tests/bug70630.phpt | |
parent | a6be0f3fd6cdd59ac00ecd76630c6c04fee03417 (diff) | |
download | php-git-35d0405c4790f0ce668c9e1b8b05197e55d29a05.tar.gz |
Allow random $this on non-internal Closures again
As it turns out, there is actually no reason to prevent this, it even was a bigger BC break than expected...
Also fixes a memory leak (the Closure leaks) when calling internal functions via Closure by moving it out of leave helper onto caller side for TOP_CODE:
$z = new SplStack; $z->push(20);
$x = (new ReflectionMethod("SplStack", "pop"))->getClosure($z);
var_dump($x());
Diffstat (limited to 'Zend/tests/bug70630.phpt')
-rw-r--r-- | Zend/tests/bug70630.phpt | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/Zend/tests/bug70630.phpt b/Zend/tests/bug70630.phpt index a46c460df0..8a42a1f5a4 100644 --- a/Zend/tests/bug70630.phpt +++ b/Zend/tests/bug70630.phpt @@ -4,7 +4,7 @@ Bug #70630 (Closure::call/bind() crash with ReflectionFunction->getClosure()) <?php class a {} -function foo() {} +function foo() { print "ok\n"; } foreach (["substr", "foo"] as $fn) { $x = (new ReflectionFunction($fn))->getClosure(); @@ -15,10 +15,9 @@ foreach (["substr", "foo"] as $fn) { ?> --EXPECTF-- -Warning: Cannot bind function substr to an object in %s on line %d +Warning: substr() expects at least 2 parameters, 0 given in %s on line %d -Warning: Cannot bind function substr to an object or class in %s on line %d +Warning: Cannot bind function substr to a class scope in %s on line %d +ok -Warning: Cannot bind function foo to an object in %s on line %d - -Warning: Cannot bind function foo to an object or class in %s on line %d +Warning: Cannot bind function foo to a class scope in %s on line %d |