mirror of
https://github.com/php/php-src.git
synced 2024-12-18 06:21:41 +08:00
5d160e309e
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.
18 lines
210 B
PHP
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)
|