|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-02-07 09:45 UTC] tony2001@php.net
[2007-02-07 12:37 UTC] denis at bytezone dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Dec 04 12:00:02 2025 UTC |
Description: ------------ When I create objects which contain a nested pointer back to itself, it cannot be compared with another object for equality. Error only occurs when the two objects being compared are the same object. Also, using === for comparison works correctly. Reproduce code: --------------- <?php $thing = new Thing (); $otherThing = new OtherThing (); $thing->otherThing = $otherThing; $otherThing->thing = $thing; $thing2 = $thing; if ($thing == $thing2) print "equal"; else print "not equal"; Class Thing { public $otherThing; } Class OtherThing { public $thing; } ?> Expected result: ---------------- I expect it to print 'equal' Actual result: -------------- Fatal error: Nesting level too deep - recursive dependency? in D:\xampp\htdocs\scraping\test.php on line 11