mirror of
https://github.com/php/php-src.git
synced 2024-09-21 18:07:23 +00:00
0b1d750d91
Closes GH-9301
32 lines
702 B
PHP
32 lines
702 B
PHP
--TEST--
|
|
ReflectionMethod::getStaticVariables() should not bleed IS_TYPE_UNINITIALIZED
|
|
--FILE--
|
|
<?php
|
|
|
|
function test() {
|
|
echo "test() called\n";
|
|
return 42;
|
|
}
|
|
|
|
function foo() {
|
|
$methodInfo = new ReflectionFunction(__FUNCTION__);
|
|
$nullWithIsTypeUninitialized = $methodInfo->getStaticVariables()['a'];
|
|
|
|
static $a = test();
|
|
var_dump($a);
|
|
|
|
// Technically, IS_TYPE_UNINITIALIZED does bleed, but it doesn't matter since there's no way we
|
|
// can assign it to the static variable directly instead of the reference.
|
|
$staticVar = &$methodInfo->getStaticVariables()['a'];
|
|
$staticVar = $nullWithIsTypeUninitialized;
|
|
}
|
|
|
|
foo();
|
|
foo();
|
|
|
|
?>
|
|
--EXPECT--
|
|
test() called
|
|
int(42)
|
|
NULL
|