#50817 [NEW]: Dangerously vague documentation for spl_object_hash()
| From: | michaelzajonz at web dot de | Date: | Thu, 21 Jan 2010 22:51:55 +0000 |
| Subject: | #50817 [NEW]: Dangerously vague documentation for spl_object_hash() | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-3766@lists.php.net to get a copy of this message | ||
From: michaelzajonz at web dot de
Operating system: --
PHP version: Irrelevant
PHP Bug Type: Documentation problem
Bug description: Dangerously vague documentation for spl_object_hash()
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
--
Edit bug report at http://bugs.php.net/?id=50817&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=50817&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=50817&r=trysnapshot53
Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=50817&r=trysnapshot60
Fixed in SVN: http://bugs.php.net/fix.php?id=50817&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=50817&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=50817&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=50817&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=50817&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=50817&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=50817&r=support
Expected behavior: http://bugs.php.net/fix.php?id=50817&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=50817&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=50817&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=50817&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50817&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=50817&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=50817&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=50817&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=50817&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=50817&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=50817&r=mysqlcfg