ID:               35053
 Updated by:       [EMAIL PROTECTED]
 Reported By:      sam at liddicott dot com
-Status:           Open
+Status:           Wont fix
 Bug Type:         Scripting Engine problem
 Operating System: Linux
 PHP Version:      4.4.0
 New Comment:

We can not change this behavior, as this might break existing scripts.



Previous Comments:
------------------------------------------------------------------------

[2005-11-01 17:02:32] sam at liddicott dot com

Description:
------------
=== does not compare two objects for identity, it compares the values
of their fields, and recursively at that! It gives wrong answers and in
some cases fails altogether!

Would you believe that === reports two different objects as being the
same object, when they are not references?

Why can't it just check if they have the same storage address, that
should be quick, painless and accurate!

There should be some way to tell when two object references refer to
the same object (apart hack in an extra field and see if it appears in
the other)

Reproduce code:
---------------
<?php

$t->name='t';
$e->name='e';

$t->e=&$e;
$e->t=&$t;

$tt=&$t;

$a->n='n';
$b->n='n';

if ($a===$b) print "Dear me A and B are the same\n";
else print "Of course A and B are different\n";

if ($tt===$t) print "Yes, of course TT and T are the same\n";
else print "No they are not\n";
?>


Expected result:
----------------
"Of course A and B are different"
"Yes, of course TT and T are the same"

Actual result:
--------------
Dear me A and B are the same

Fatal error: Nesting level too deep - recursive dependency? in
/home/sam/projects/reporter/t.php on line 17



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=35053&edit=1

Reply via email to