Skip to content

Delete an outdated comment for read_property and read_dimension #6618

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

sj-i
Copy link
Contributor

@sj-i sj-i commented Jan 18, 2021

The comment is outdated as of PHP7.
For example, in the current code, zend_assign_op_overloaded property() expects the refcount of the returned value from read_property to be greater than 0 when the returned value is a refcounted, to call zval_ptr_dtor() later.

This is a follow-up of #6597.

History

@sj-i sj-i marked this pull request as draft January 18, 2021 23:07
…skip]

The comment is outdated as of PHP7.
For example, in the current code, zend_assign_op_overloaded_property() expects the refcount of the returned value from read_property to be greater than 0 when the returned value is a refcounted, to call zval_ptr_dtor() later.

# History
- The same description was originally written in a commit in 2004 alongside the write side. php@c8c0e97
- One requested to put the description in somewhere. https://externals.io/message/7789
- Then it was added as a comment in zend_object_handler.h . php@7d3215d
- At the time the comment was written, there were at least three places where the code actually set the reference count to 0 in read_properties.
	- https://github.com/php/php-src/blob/7d3215d33321173c58db4d86b7398e16c5c55d13/ext/dom/php_dom.c#L229
	- https://github.com/php/php-src/blob/7d3215d33321173c58db4d86b7398e16c5c55d13/ext/mysqli/mysqli.c#L190
	- https://github.com/php/php-src/blob/7d3215d33321173c58db4d86b7398e16c5c55d13/ext/simplexml/simplexml.c#L245
- All three of the above were removed during the development of PHP 7.
	- php@2f0a758
	- php@2402d6c
	- php@a975c7e
- In the current code, even when they generate and return a refcounted value, its refcount would be 1.
@sj-i sj-i force-pushed the fix-outdated-read_property-comment branch from 103c5fe to f50d5cf Compare January 18, 2021 23:09
@sj-i sj-i changed the title Delete an outdated comment for read_property. [ci skip] Delete an outdated comment for read_property and read_dimension Jan 18, 2021
@sj-i sj-i marked this pull request as ready for review January 18, 2021 23:09
@php-pulls php-pulls closed this in 6a1e74e Jan 19, 2021
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.

2 participants