#31449 [Asn->Bgs]: Comparison of class with recursive references causes fatal
| From: | stas@php.net | Date: | Wed, 18 May 2005 08:41:51 +0000 |
| Subject: | #31449 [Asn->Bgs]: Comparison of class with recursive references causes fatal | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-79125@lists.php.net to get a copy of this message | ||
ID: 31449
Updated by: stas@php.net
Reported By: marcus at lastcraft dot com
-Status: Assigned
+Status: Bogus
Bug Type: Class/Object related
Operating System: *
PHP Version: 5CVS-2005-03-06
Assigned To: andi
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
I don't think it's a bug. You can not compare these objects since they
contain circular references, so comparison process descends to the
endless loop. You may want to use custom method to compare objects -
bit-comparison of objects is generally not the best idea.
Previous Comments:
------------------------------------------------------------------------
[2005-01-08 05:31:19] marcus at lastcraft dot com
Description:
------------
Hi...
The script below causes a fatal error. This is just the simplest
example I could find of a whole class of these problems. Makes
comparing any object problematical.
yours, Marcus
Reproduce code:
---------------
<?php
class Recursive {
private $me;
function __construct() {
$this->me = $this;
}
}
new Recursive() != new Recursive();
?>
Expected result:
----------------
Nothing as the comparison is not output.
Actual result:
--------------
Fatal error with nesting too deep.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=31449&edit=1