/
vshmidt
/
php
Обзор
Документация
Войти
/
vshmidt
/
php
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
ext/spl/tests/ArrayObject/gh16646.phpt
33 строки
680 B
Gina Peter Banyard
ext/spl: Deprecate ArrayObject and ArrayIterator with objects (#19420)
14 авг 2025, 14:38
Не верифицирован
14 авг 2025, 14:38
fb87b14
Код
Авторство
О чём код?
--TEST-- GH-16646: Use-after-free in ArrayObject::unset() with destructor --FILE-- <?php class B { public $b; function __construct($arg) { $this->b = $arg; } } class C { function __destruct() { global $arr; echo __METHOD__, "\n"; $arr->exchangeArray([]); } } $arr = new ArrayObject(new B(new C)); unset($arr["b"]); var_dump($arr); ?> --EXPECTF-- Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d C::__destruct object(ArrayObject)#1 (1) { ["storage":"ArrayObject":private]=> array(0) { } }