php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67989 object_spl_hash give to identical values
Submitted: 2014-09-09 19:50 UTC Modified: 2014-09-09 20:49 UTC
From: dipsik at gmail dot com Assigned:
Status: Closed Package: hash related
PHP Version: 5.5.16 OS: windows 7
Private report: No CVE-ID: None
 [2014-09-09 19:50 UTC] 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.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-09-09 19:52 UTC] dipsik at gmail dot com
I create new object "Bar" (not Customer)

-- I mean "not Foo",
 [2014-09-09 20:16 UTC] requinix@php.net
-Status: Open +Status: Feedback
 [2014-09-09 20:16 UTC] 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 20:20 UTC] dipsik at gmail dot com
-Status: Feedback +Status: Open
 [2014-09-09 20:20 UTC] dipsik at gmail dot com
In xdebug I see two differnt objects (with different class) with same hash.
 [2014-09-09 20:21 UTC] requinix@php.net
-Status: Open +Status: Feedback
 [2014-09-09 20:21 UTC] 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.

^ Read that.
 [2014-09-09 20:49 UTC] dipsik at gmail dot com
-Status: Feedback +Status: Closed
 [2014-09-09 20:49 UTC] dipsik at gmail dot com
Now i think its Doctine bug, not php. Close it.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 06:01:30 2024 UTC