/
vshmidt
/
php
Обзор
Документация
Войти
/
vshmidt
/
php
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
ext/spl/tests/ArrayObject/gh15833_2.phpt
42 строки
1 KB
Gina Peter Banyard
ext/spl: Deprecate ArrayObject and ArrayIterator with objects (#19420)
14 авг 2025, 14:38
Не верифицирован
14 авг 2025, 14:38
fb87b14
Код
Авторство
О чём код?
--TEST-- GH-15833 (Segmentation fault (access null pointer) in ext/spl/spl_array.c) --CREDITS-- YuanchengJiang --FILE-- <?php class C { public int $a = 1; } $reflector = new ReflectionClass(C::class); $obj = $reflector->newLazyProxy(function ($obj) { static $counter = 0; throw new Error('nope ' . ($counter++)); }); $recursiveArrayIterator = new RecursiveArrayIterator($obj); try { var_dump($recursiveArrayIterator->current()); } catch (Error $e) { echo $e->getMessage(), "\n"; } try { var_dump($recursiveArrayIterator->current()); } catch (Error $e) { echo $e->getMessage(), "\n"; } try { $recursiveArrayIterator->next(); } catch (Error $e) { echo $e->getMessage(), "\n"; } try { var_dump($recursiveArrayIterator->current()); } catch (Error $e) { echo $e->getMessage(), "\n"; } ?> --EXPECTF-- Deprecated: ArrayIterator::__construct(): Using an object as a backing array for ArrayIterator is deprecated, as it allows violating class constraints and invariants in %s on line %d nope 0 nope 1 nope 2 nope 3