Skip to content

Fix GH-12265: Cloning an object breaks serialization recursion - #12287

Closed
ndossche wants to merge 2 commits into
php:PHP-8.3from
ndossche:fix-12265
Closed

ndossche wants to merge 2 commits into
php:PHP-8.3from
ndossche:fix-12265

Conversation

@ndossche

@ndossche ndossche commented Sep 23, 2023 •

Copy link
Copy Markdown
Member

It broke because of the refcount==1 condition added in 6c5942f. Removing that condition would work, but remove an optimization. The test file starts with the outer object at RC1 so it isn't registered in var_hash, but during serialization it gets an additional reference so now we have a problem.

@ndossche ndossche linked an issue Sep 23, 2023 that may be closed by this pull request
@ndossche
ndossche requested a review from dstogov September 24, 2023 17:17
Comment thread ext/standard/var.c Outdated
@bukka

bukka commented Sep 8, 2025 •

Copy link
Copy Markdown
Member

@nielsdos Is there any reason (except possibly perf impact) why this wasn't merged? (sorry about notification mess up - commented first on the issue...)

@ndossche

ndossche commented Sep 8, 2025 •

Copy link
Copy Markdown
Member Author

@bukka because no one reviewed this final version of the pr and therefore did not get approval.
I don't think serialization hooks are so common that this will cause issues?
I can rebase this if you want me to pick this up again.

@ndossche
ndossche changed the base branch from PHP-8.1 to PHP-8.3 September 8, 2025 16:57
@ndossche
ndossche requested a review from bukka as a code owner September 8, 2025 16:57
@ndossche

ndossche commented Sep 8, 2025

Copy link
Copy Markdown
Member Author

Rebased on 8.3.

@ndossche ndossche closed this in f6f1748 Sep 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cloning an object breaks serialization recursion

3 participants