php-src/Zend/tests/closure_bindTo_preserves_used_variables.phpt
Nikita Popov 5d160e309e Fix static variable behavior with inheritance
When a method is inherited, the static variables will now always
use the initial values, rather than the values at the time of
inheritance. As such, behavior no longer depends on whether
inheritance happens before or after a method has been called.

This is implemented by always keeping static_variables as the
original values, and static_variables_ptr as the modified copy.

Closes GH-6705.
2021-02-18 11:18:19 +01:00

18 lines
210 B
PHP

--TEST--
Closure::bindTo() should preserve used variables
--FILE--
<?php
$var = 0;
$fn = function() use($var) {
var_dump($var);
};
$fn();
$fn = $fn->bindTo(null, null);
$fn();
?>
--EXPECT--
int(0)
int(0)