#50817 [Opn]: Dangerously vague documentation for spl_object_hash()

From: Date: Thu, 21 Jan 2010 22:56:35 +0000
Subject: #50817 [Opn]: Dangerously vague documentation for spl_object_hash()
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-3767@lists.php.net to get a copy of this message
ID: 50817 User updated by: michaelzajonz at web dot de Reported By: michaelzajonz at web dot de Status: Open Bug Type: Documentation problem Operating System: -- PHP Version: Irrelevant New Comment: (Of course the reproduce code results in different output. Excpected/actual result apply to the documentation problem) Previous Comments: ------------------------------------------------------------------------ [2010-01-21 22:51:54] 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 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=50817&edit=1

« previous php.doc.bugs (#3767) next »