Skip to content

Reject uninstantiable payload classes with NotInstantiableException - #50

Open
nicolas-grekas wants to merge 2 commits into
mainfrom
align-rejections
Open

nicolas-grekas wants to merge 2 commits into
mainfrom
align-rejections

Conversation

@nicolas-grekas

@nicolas-grekas nicolas-grekas commented Sep 26, 2026 •

Copy link
Copy Markdown
Member

deepclone_from_array() let the engine throw an Error for abstract classes, interfaces, traits and enums named in a payload, while deepclone_hydrate() and the polyfill throw DeepClone\NotInstantiableException. It now throws that too, from the class lookup that runs once per class and call, and the README lists these classes in its Errors section.

deepclone_hydrate() also words its messages Type "X" is not instantiable. like the other functions, the polyfill and VarExporter do, instead of Class "X".

This builds on #47. The polyfill gets the same rules in symfony/polyfill#703.

deepclone_from_array() let object_init_ex() throw its Error for abstract
classes, interfaces, traits and enums named in a payload, where
deepclone_hydrate() and the polyfill throw NotInstantiableException. The
class lookup now throws it, once per class and call.

deepclone_hydrate() now words NotInstantiableException messages
'Type "X" is not instantiable.' like deepclone_to_array(),
deepclone_from_array(), the polyfill and VarExporter do, instead of
'Class "X" is not instantiable.'.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant