Bug #61453 [Asn->Csd]: SplObjectStorage does not identify objects correctly
| From: | cataphract@php.net | Date: | Wed, 21 Mar 2012 12:45:59 +0000 |
| Subject: | Bug #61453 [Asn->Csd]: SplObjectStorage does not identify objects correctly | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-168688@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=61453&edit=1
ID: 61453
Updated by: cataphract@php.net
Reported by: jhgundersen at gmail dot com
Summary: SplObjectStorage does not identify objects correctly
-Status: Assigned
+Status: Closed
Type: Bug
Package: SPL related
Operating System: Linux
PHP Version: 5.4.0
Assigned To: cataphract
Block user comment: N
Private report: N
New Comment:
Fixed in git. Thank you.
Previous Comments:
------------------------------------------------------------------------
[2012-03-20 12:41:55] jhgundersen at gmail dot com
Description:
------------
When I have a large collection of objects stored in a SplObjectStorage it starts
to behave strange. It says that an object already exists in the storage and
returns the stored data for another object.
Test script:
---------------
$limit = 1000;
$objects = new SplObjectStorage;
for($i = 0; $i < $limit; $i++){
$object = new StdClass;
if(isset($objects[$object])){
die("this should never happen, but did after $i iteration");
}
$objects[$object] = 1;
}
echo "\nfinished\n";
Expected result:
----------------
The script should never enter the if condition and die, because the object has
not been added to the object storage yet
Actual result:
--------------
The scripts dies because of it finding an object in the storage that should not
have been there. This happens at random iteration, i'm guessing based on memory
usage or something.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=61453&edit=1