-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Fixed bug #53071 (SPLObjectStorage defeats gc_collect_cycles).
- Loading branch information
1 parent
3cb6a46
commit 5721132
Showing
3 changed files
with
90 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--TEST-- | ||
Bug #53071 (Usage of SPLObjectStorage defeats gc_collect_cycles) | ||
--FILE-- | ||
<?php | ||
class myClass | ||
{ | ||
public $member; | ||
} | ||
function LimitedScope() | ||
{ | ||
$myA = new myClass(); | ||
$myB = new SplObjectStorage(); | ||
$myC = new myClass(); | ||
$myC->member = $myA; // myC has a referece to myA | ||
$myB->Attach($myC); // myB attaches myC | ||
$myA->member = $myB; // myA has myB, comleting the cycle | ||
} | ||
LimitedScope(); | ||
var_dump(gc_collect_cycles()); | ||
|
||
echo "Done.\n"; | ||
|
||
?> | ||
--EXPECTF-- | ||
int(5) | ||
Done. |