#47045 [NEW]: Bug when comparing SplObjectStorage instances
From: karsten at typo3 dot org
Operating system: Mac OS X 10.5.6
PHP version: 5.3.0alpha3
PHP Bug Type: SPL related
Bug description: Bug when comparing SplObjectStorage instances
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 bug report at http://bugs.php.net/?id=47045&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=47045&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=47045&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=47045&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=47045&r=fixedcvs
Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=47045&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=47045&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=47045&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=47045&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=47045&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=47045&r=support
Expected behavior: http://bugs.php.net/fix.php?id=47045&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=47045&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=47045&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=47045&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=47045&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=47045&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=47045&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=47045&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=47045&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=47045&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=47045&r=mysqlcfg
Thread (3 messages)
- karsten at typo3 dot org