diff options
author | Bob Weinand <bobwei9@hotmail.com> | 2015-06-21 16:39:28 +0200 |
---|---|---|
committer | Bob Weinand <bobwei9@hotmail.com> | 2015-06-21 16:39:44 +0200 |
commit | 3c288b12b45763b3215ee0463e51f8be9d643425 (patch) | |
tree | 4937773981da14cf270cf7fca06a59ae42951642 /Zend/tests/closure_060.phpt | |
parent | f3df3df8737ace9f4431416fdd0d312cb0ee9cfd (diff) | |
download | php-git-3c288b12b45763b3215ee0463e51f8be9d643425.tar.gz |
Fix bad run_time_cache with Closure::call()
This also fixes a memory "leak" (memory is allocated on unbounded arena without limits) on each new Closure instantiation.
Closures with same scope now all share the same run_time_cache (as long as it is arena allocated)
Diffstat (limited to 'Zend/tests/closure_060.phpt')
-rw-r--r-- | Zend/tests/closure_060.phpt | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/Zend/tests/closure_060.phpt b/Zend/tests/closure_060.phpt new file mode 100644 index 0000000000..f03160dab9 --- /dev/null +++ b/Zend/tests/closure_060.phpt @@ -0,0 +1,25 @@ +--TEST-- +runtime cache must be invalidated for Closure::call() +--FILE-- +<?php + +class A { + private static $priv = 7; + + static function get() { + return function() { + var_dump(isset(A::$priv)); + }; + } +} + +$closure = A::get(); +$closure(); // init rt_cache +$closure->call(new class(){}, null); +$closure(); + +?> +--EXPECT-- +bool(true) +bool(false) +bool(true) |