Skip to content

[DeepClone] Reject malformed deepclone_from_array() input without warnings#627

Merged
nicolas-grekas merged 1 commit into
1.xfrom
deepclone-malformed-input
Jun 8, 2026
Merged

[DeepClone] Reject malformed deepclone_from_array() input without warnings#627
nicolas-grekas merged 1 commit into
1.xfrom
deepclone-malformed-input

Conversation

@nicolas-grekas

Copy link
Copy Markdown
Member
Q A
Branch? 1.x
Bug fix? yes
New feature? no
Deprecations? no
Issues -
License MIT

Brings the polyfill in line with the extension's handling of malformed deepclone_from_array() payloads:

  • A serialized class-name blob that does not unserialize() to an object (e.g. an i:, s: or a: form) is now rejected with a \ValueError instead of being stored and treated as an object.
  • A PHP_INT_MIN reference id on the object-reference, named-closure and prepared paths no longer reaches -$id, which overflows to a float and emits a runtime warning before the error. The hard-ref paths and the properties-loop object-ref path were already guarded; the remaining three sites now throw a clean \ValueError too.

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

…nings

A serialized class-name blob that does not unserialize() to an object is now rejected with a \ValueError instead of being stored and treated as an object. A PHP_INT_MIN reference id on the object-reference, named-closure and "prepared" paths no longer reaches -$id, which overflows to a float and emits a runtime warning before the error. Mirrors symfony/php-ext-deepclone#19.
@nicolas-grekas nicolas-grekas reopened this Jun 8, 2026
@nicolas-grekas nicolas-grekas merged commit 6030cfb into 1.x Jun 8, 2026
45 of 60 checks passed
@nicolas-grekas nicolas-grekas deleted the deepclone-malformed-input branch June 8, 2026 16:55
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