Bug #67989 [Opn->Fbk]: object_spl_hash give to identical values
| From: | requinix@php.net | Date: | Tue, 09 Sep 2014 20:21:25 +0000 |
| Subject: | Bug #67989 [Opn->Fbk]: object_spl_hash give to identical values | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-187481@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=67989&edit=1
ID: 67989
Updated by: requinix@php.net
Reported by: dipsik at gmail dot com
Summary: object_spl_hash give to identical values
-Status: Open
+Status: Feedback
Type: Bug
Package: hash related
Operating System: windows 7
PHP Version: 5.5.16
Block user comment: N
Private report: N
New Comment:
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves.
A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external
resources such as databases, etc. If the script requires a
database to demonstrate the issue, please make sure it creates
all necessary tables, stored procedures etc.
Please avoid embedding huge scripts into the report.
^ Read that.
Previous Comments:
------------------------------------------------------------------------
[2014-09-09 20:20:39] dipsik at gmail dot com
In xdebug I see two differnt objects (with different class) with same hash.
------------------------------------------------------------------------
[2014-09-09 20:16:09] requinix@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves.
A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external
resources such as databases, etc. If the script requires a
database to demonstrate the issue, please make sure it creates
all necessary tables, stored procedures etc.
Please avoid embedding huge scripts into the report.
spl_object_hash() only guarantees uniqueness for objects that still exist in memory, but it
doesn't sound like that's the issue here.
------------------------------------------------------------------------
[2014-09-09 19:52:11] dipsik at gmail dot com
I create new object "Bar" (not Customer)
-- I mean "not Foo",
------------------------------------------------------------------------
[2014-09-09 19:50:45] dipsik at gmail dot com
Description:
------------
Version tested with 5.4, 5.5.13, 5.5.16
I use symfony and doctrine.
In sometime doctrine creates hash map array with spl_object_hash for proxy object "Foo"
Then, there is my buiseness logic, and in sometime I create new object "Bar" (not
Customer), which spl_object_hash is in doctrine hash array. I marked that, when my object
"Bar" cant persist in my database, because doctrine find hash from other object
"Foo" and think object is managed.
I noticed, that any object created before "Bar" become with the same object hash, and Bar
has different hash.
So, only order of init objects are influence to object hash.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=67989&edit=1