/
vshmidt
/
php
Обзор
Документация
Войти
/
vshmidt
/
php
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
ext/reflection/tests/ReflectionMethod_getStaticVariables_basic_extra_bleed.phpt
31 строка
702 B
Ilija Tovilo
Allow arbitrary expressions in static variable initializer
24 май 2023, 21:17
Не верифицирован
24 май 2023, 21:17
0b1d750
Код
Авторство
О чём код?
--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