php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #50817 Dangerously vague documentation for spl_object_hash()
Submitted: 2010-01-21 22:51 UTC Modified: 2010-01-21 22:58 UTC
From: michaelzajonz at web dot de Assigned:
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS: --
Private report: No CVE-ID: None
 [2010-01-21 22:51 UTC] michaelzajonz at web dot de
Description:
------------
This is NOT a bug report regarding the implementation of spl_object_hash() but rather its documentation!

It says there (http://de.php.net/manual/en/function.spl-object-hash.php) for the return value of function spl_object_hash():

"A string that is unique for each object and is always the same for the same object."

I used this function for a while now, also in production environment. Recently I coincidentally discovered a user-contributed comment saying that the IDs of destroyed objects will be reused.

The Documentation itself should say so, I think.

While debugging some other issue in my code I actually observed a case where this would have led to a serious problem (for now, I just appended the current microtime, since the class I'm dealing with is kinda huge and takes a while to instantiate. Still sucks of course.).

Reproduce code:
---------------
var_dump(spl_object_hash(new stdClass()), spl_object_hash(new stdClass()));

Expected result:
----------------
"A string that is unique for each object and is always the same for the same object."

Actual result:
--------------
"A string that is unique for each currently existing object and is always the same for the same object."

or something like that

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-01-21 22:56 UTC] michaelzajonz at web dot de
(Of course the reproduce code results in different output. Excpected/actual result apply to the documentation problem)
 [2010-01-21 22:58 UTC] svn@php.net
Automatic comment from SVN on behalf of degeberg
Revision: http://svn.php.net/viewvc/?view=revision&revision=293824
Log: Fixed bug #50817 (Dangerously vague documentation for spl_object_hash())
 [2010-01-21 22:58 UTC] degeberg@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 [2020-02-07 06:09 UTC] phpdocbot@php.net
Automatic comment on behalf of degeberg
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=1fbeec522e9ed9bd756f7e955679fbbfd8de9159
Log: Fixed bug #50817 (Dangerously vague documentation for spl_object_hash())
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Wed Oct 07 23:00:01 2026 UTC