Re: Recursive classes ... possible bug?
| From: | Greg Beaver | Date: | Wed, 06 Jun 2007 16:56:53 +0000 |
| Subject: | Re: Recursive classes ... possible bug? | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-30118@lists.php.net to get a copy of this message | ||
Antony Dovgal wrote:
> On 06.06.2007 11:08, mark@cyanox.nl wrote:
>>> Why?
>>> The behavior is quite clear - if the objects are instances of the
>>> same class, we have no other way to compare them but to compare their
>>> properties, this also applies to properties' properties and
>>> properties' properties' properties etc.
>> Well yes but in this case they are the same instance. Comparing the
>> properties is then useless since they will always be the same.
>>
>> Well there could be made a check to see if the objects are the same
>> instance (like with ===) before actually checking the properties.
>
> Hm.. I was actually a bit surprised to see that we don't do "===" before
> doing "==" on objects.
> That would of course prevent the recursion in case of comparing an
> object to itself.
>
> I committed a patch minute ago, but it obviously won't change the case
> when the objects are different and contain circular references.
> Anyway, thanks a lot for pointing this out.
This is especially surprising because I mentioned this in Oct. 2004
(http://groups.google.com/group/mailing.www.php-dev/msg/c3bcb36e5c6eb07b?dmode=source&hl=en)
and Andi took this on:
http://groups.google.com/group/mailing.www.php-dev/msg/4429a975af7e4924?dmode=source&hl=en
then claimed to have fixed it:
http://groups.google.com/group/mailing.www.php-dev/msg/6ad9e1b23bf4862e?dmode=source&hl=en
However, a scan of all CVS commits between Oct. 19-21 at news.php.net
(this took a while) revealed no commits at all, and looking at
zend_operators.c in both Zend/ and ZendEngine2 reveals no commits by
Andi anywhere near this time.
Sounds like it just slipped through the cracks somehow.
Greg