Description
Description
spl_object_id
is often used as a key to store/cache some data related to a specific object instance.
Current behaviour
Currently the returned value can be resused for another object when the original object was released from memory. When the returned value can be resused, it does not provide huge benefit for the user.
Improved behaviour
This is a feature request to update spl_object_id
to return always a new/unique value. When the returned value is always guaranteed to be never reused per php instance lifetime, user can rely on this fact without having to further compare the object instance equality (which requires storing the original object reference or some additional value).
x86 version should maintain this new behaviour until all positive integers are used/returned, then reusing of released values can be allowed (preferably with some way to check the exhaustion from user code)
x64 version positive integers space is enough to never overflow in php instance lifetime (would take 292 years to exhaust when every 1ns would be created 1 object [1])
[1] https://www.google.com/search?q=%3D(2^63%2F10^9)%2F(3600*24*365)