/
vshmidt
/
php
Обзор
Документация
Войти
/
vshmidt
/
php
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
ext/reflection/tests/bug38653.phpt
30 строк
658 B
Daniel Scherzer
[RFC] Deprecate ReflectionClass::getConstant() for missing constants (#19456)
12 авг 2025, 15:50
Не верифицирован
12 авг 2025, 15:50
ffdc104
Код
Авторство
О чём код?
--TEST-- Bug #38653 (memory leak in ReflectionClass::getConstant()) --FILE-- <?php class foo { const cons = 10; const cons1 = ""; const cons2 = "test"; } class bar extends foo { } $foo = new ReflectionClass("foo"); var_dump($foo->getConstant("cons")); var_dump($foo->getConstant("cons1")); var_dump($foo->getConstant("cons2")); var_dump($foo->getConstant("no such const")); echo "Done\n"; ?> --EXPECTF-- int(10) string(0) "" string(4) "test" Deprecated: ReflectionClass::getConstant() for a non-existent constant is deprecated, use ReflectionClass::hasConstant() to check if the constant exists in %s on line %d bool(false) Done