Skip to content

Replace spl_object_hash() with spl_object_id()#369

Merged
thekid merged 2 commits into
xp-framework:mainfrom
thekid:refactor/spl_object_hash
Jun 27, 2026
Merged

Replace spl_object_hash() with spl_object_id()#369
thekid merged 2 commits into
xp-framework:mainfrom
thekid:refactor/spl_object_hash

Conversation

@thekid

@thekid thekid commented Jun 27, 2026

Copy link
Copy Markdown
Member

Quoting https://externals.io/message/131452#131487:

Is spl_object_hash() still useful? The string it creates used to be
quite a bit more complex, but eventually it became equivalent to

str_pad(dechex(spl_object_id($obj)), 16, '0', STR_PAD_LEFT).'0000000000000000'

I.e., it provides exactly the same content as spl_object_id, but in a
much more obtuse way. For anyone needing that format, the polyfill is
just above.

Forward compatibility, see #368

@thekid thekid merged commit f4e12e3 into xp-framework:main Jun 27, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

1 participant