mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_splobjectstoragecontains_splobjectstorageattach_and_splobjectstoragedetach
28 lines
512 B
PHP
28 lines
512 B
PHP
--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.
|