mirror of
https://github.com/php/php-src.git
synced 2024-12-19 15:00:15 +08:00
3c288b12b4
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)
26 lines
353 B
PHP
26 lines
353 B
PHP
--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)
|