Skip to content

[DeepClone] Fix cloning objects with numeric property names#626

Merged
nicolas-grekas merged 1 commit into
1.xfrom
deepclone-numeric-props
Jun 8, 2026
Merged

[DeepClone] Fix cloning objects with numeric property names#626
nicolas-grekas merged 1 commit into
1.xfrom
deepclone-numeric-props

Conversation

@nicolas-grekas

Copy link
Copy Markdown
Member
Q A
Branch? 1.x
Bug fix? yes
New feature? no
Deprecations? no
Issues Fix symfony/symfony#64548
License MIT

A numeric property name like $o->{'999'} round-trips through serialize(), but deepclone_from_array() rejected the integer array key PHP produces when normalizing it (to_array() already emits it as an int via the (array) cast). Accept numeric property names, matching unserialize() and the extension.

Companion extension fix: symfony/php-ext-deepclone#18.

@nicolas-grekas nicolas-grekas force-pushed the deepclone-numeric-props branch from 5f2c6e6 to fb7b36d Compare June 8, 2026 14:23
A numeric property name (e.g. $o->{'999'}) round-trips through serialize()
but deepclone_from_array() rejected the integer array key PHP produces when
normalizing it. Accept numeric property names, matching the extension and
unserialize().

Fixes symfony/symfony#64548.
@nicolas-grekas nicolas-grekas force-pushed the deepclone-numeric-props branch from fb7b36d to 1853d9c Compare June 8, 2026 14:27
@nicolas-grekas nicolas-grekas merged commit 024f4f7 into 1.x Jun 8, 2026
30 of 40 checks passed
@nicolas-grekas nicolas-grekas deleted the deepclone-numeric-props branch June 8, 2026 14:40
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.

[Cache][VarExporter] DeepCloner fails to clone object with numeric property names

1 participant