#47045 [Asn->Csd]: Bug when comparing SplObjectStorage instances
| From: | colder@php.net | Date: | Wed, 14 Jan 2009 15:53:12 +0000 |
| Subject: | #47045 [Asn->Csd]: Bug when comparing SplObjectStorage instances | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-132861@lists.php.net to get a copy of this message | ||
ID: 47045
Updated by: colder@php.net
Reported By: karsten at typo3 dot org
-Status: Assigned
+Status: Closed
Bug Type: SPL related
Operating System: Mac OS X 10.5.6
PHP Version: 5.3.0alpha3
Assigned To: colder
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2009-01-09 10:21:42] karsten at typo3 dot org
Description:
------------
Two instances of SplObjectStorage should be considered equal only if
they contain the same objects, when using == for comparison.
Reproduce code:
---------------
<?php
$someObject = new \stdClass();
$objectStorage = new \SplObjectStorage();
$objectStorage1 = new \SplObjectStorage();
var_dump($objectStorage === $objectStorage1); // FALSE, fine
var_dump($objectStorage == $objectStorage1); // TRUE, fine
$objectStorage->attach($someObject);
var_dump($objectStorage === $objectStorage1); // FALSE, fine
var_dump($objectStorage == $objectStorage1); // TRUE, huh?
$objectStorage1->attach($someObject);
var_dump($objectStorage === $objectStorage1); // FALSE, fine
var_dump($objectStorage == $objectStorage1); // TRUE, fine
?>
Expected result:
----------------
bool(false)
bool(true)
bool(false)
bool(false)
bool(false)
bool(true)
Actual result:
--------------
bool(false)
bool(true)
bool(false)
bool(true)
bool(false)
bool(true)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=47045&edit=1