Commit Graph

8 Commits

Author SHA1 Message Date
Dmitry Stogov
23b372d358 Forbid "fake" closure rebinding 2015-10-12 20:34:08 +02:00
Dmitry Stogov
0847681b1a Fixed bug #70630 (Closure::call/bind() crash with ReflectionFunction->getClosure()) 2015-10-09 11:48:13 +03:00
Dmitry Stogov
e0b3b3c752 Revert "Fixed bug #70630 (Closure::call/bind() crash with ReflectionFunction->getClosure())"
This reverts commit 517b553625.
2015-10-06 23:59:36 +03:00
Dmitry Stogov
e193d35c1e Revert "Improve 517b55362 (scope rebinding on method Closures)"
This reverts commit 881c502520.
2015-10-06 23:48:15 +03:00
Dmitry Stogov
524d00e005 Revert "Allow random $this on non-internal Closures again"
This reverts commit 35d0405c47.
2015-10-06 23:48:10 +03:00
Bob Weinand
35d0405c47 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());
2015-10-05 17:49:32 +02:00
Bob Weinand
881c502520 Improve 517b55362 (scope rebinding on method Closures)
Now it is completely impossible to rebind a scoped method Closure (only the kind you get from ReflectionMethod::getClosure()) to a foreign scope
Adding a lot of tests to ensure this...
Also, properly return NULL in case the Closure could not be created instead of some crippled unbound Closure
2015-10-05 00:56:55 +02:00
Bob Weinand
517b553625 Fixed bug #70630 (Closure::call/bind() crash with ReflectionFunction->getClosure())
This additionally removes support for binding to an unknown (not in parent hierarchy) scope.
Removing support for cross-scope is necessary for certain compile-time assumptions (like class constants) to prevent unexpected results
2015-10-04 01:38:59 +02:00