Bob Weinand [Wed, 14 Oct 2015 10:07:04 +0000 (12:07 +0200)]
Do not create a fake Closure for real Closures
That is solved by just returning the Closure as is, which is safe due to Closures being immutable objects
Anatol Belski [Tue, 13 Oct 2015 08:29:26 +0000 (10:29 +0200)]
Merge branch 'PHP-7.0' into PHP-7.0.0
* PHP-7.0: (103 commits)
Add more tests for closure binding
Forbid "fake" closure rebinding
increase API versions
fork test for ICU 56.1
fork test for ICU-56.1
fix test for ICU-56.1
fix test
Double declaration
fix stack overflow
Generally run all tests in sapi folder by default
Fixed bug #70685
Normalize rebinding failures
Implemented file_cache_fallback mechanism
Improve previous fix
Fixed bug #70681
update NEWS
update NEWS
Fixed bug #70630 (Closure::call/bind() crash with ReflectionFunction->getClosure())
Fixed reference cuntmting for closures (previously we didn't increment reference counter for "internal" closures)
Fixed infinity recurion if we create closure on top of other closure.
...
Nikita Popov [Sat, 10 Oct 2015 11:39:26 +0000 (13:39 +0200)]
Normalize rebinding failures
Move all rebinding checks into one function to make sure they stay
in sync. Normalize return value to be NULL for all rebinding
failures, instead of returning an improperly bound closure in some
cases.
Anatol Belski [Fri, 9 Oct 2015 21:07:10 +0000 (23:07 +0200)]
Implemented file_cache_fallback mechanism
which is essential as an attempt to fix the "failed to reattach"
error on Windows. If file_cache is enabled, Opcache will
automaticaly switch to file_cache_only mode in the case a process
failed to map the shared segment at the required address. The
important small part of the SHM will still be mapped, which
allows information exchange between normal processes using SHM
and those using the fallback mechanism.
This is based on Dmitry's, Matt's and mine ideas. So many thanks for
support!
Dmitry Stogov [Wed, 7 Oct 2015 11:09:37 +0000 (14:09 +0300)]
Fixed test.
MySQL and MariaDB of different versions have different assumptions about TIMESTAMP attributes.
Probably we need to add yet another condition to also check MariaDB version.
Bob Weinand [Mon, 5 Oct 2015 15:49:32 +0000 (17:49 +0200)]
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());
Bob Weinand [Sun, 4 Oct 2015 22:52:10 +0000 (00:52 +0200)]
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
Bob Weinand [Sat, 3 Oct 2015 23:38:59 +0000 (01:38 +0200)]
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
Nikita Popov [Fri, 2 Oct 2015 06:59:22 +0000 (08:59 +0200)]
More check_parameters improvements
* Switch default REPORT_LEVEL to 1 to cut down on the noise
* Make initialization of 'C' variable always required
* Don't require init of lLdb variable if ! is used
* Don't throw error about missing init of not detected parameters
(This was a regression in the last changeset)
* Support method_parameters and throw variations