Skip to content

zend_objects: Remove unnecessary refcounting when calling __clone() - #19145

Merged
TimWolla merged 1 commit into
php:masterfrom
TimWolla:clone-refcount
Jul 16, 2025
Merged

zend_objects: Remove unnecessary refcounting when calling __clone()#19145
TimWolla merged 1 commit into
php:masterfrom
TimWolla:clone-refcount

Conversation

@TimWolla

@TimWollaTimWolla commented Jul 16, 2025

Copy link
Copy Markdown
Member

Found as part of the clone-with review in #18747.


Specifically: https://github.com/php/php-src/pull/18747/files#r2209484855

@iluuu1994iluuu1994 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assuming the caller of zend_objects_clone_members() holds a strong reference to new_object that cannot be invalidated by __clone is reasonable.

@ndosschendossche left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried to cheat it, for example with creating self-references, but it seems fine.

@TimWolla
TimWolla merged commit 2e0c011 into php:masterJul 16, 2025
9 checks passed
@TimWolla
TimWolla deleted the clone-refcount branch July 16, 2025 16:53
Sign up for freeto 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.

3 participants

@TimWolla@iluuu1994@ndossche