/
vshmidt
/
php
Обзор
Документация
Войти
/
vshmidt
/
php
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
ext/spl/tests/SplObjectStorage/bug53071.phpt
27 строк
512 B
Gina Peter Banyard
ext/spl: Deprecate SplObjectStorage::contains(), SplObjectStorage::attach(), and SplObjectStorage::detach() (#19424)
09 авг 2025, 13:36
Не верифицирован
09 авг 2025, 13:36
1687231
Код
Авторство
О чём код?
--TEST-- Bug #53071 (Usage of SplObjectStorage defeats gc_collect_cycles) --FILE-- <?php gc_enable(); class myClass { public $member; } function LimitedScope() { $myA = new myClass(); $myB = new SplObjectStorage(); $myC = new myClass(); $myC->member = $myA; // myC has a reference to myA $myB->offsetSet($myC); // myB attaches myC $myA->member = $myB; // myA has myB, completing the cycle } LimitedScope(); var_dump(gc_collect_cycles()); echo "Done.\n"; ?> --EXPECT-- int(3) Done.