Skip to content

Commit 6a1e74e

Browse files
sj-inikic
authored andcommitted
Delete an outdated comment for read_property and read_dimension. [ci 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. 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 . 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. - 2f0a758 - 2402d6c - a975c7e - In the current code, even when they generate and return a refcounted value, its refcount would be 1. Closes GH-6618.
1 parent a9efcb1 commit 6a1e74e

File tree

1 file changed

+0
-4
lines changed

1 file changed

+0
-4
lines changed

Zend/zend_object_handlers.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,6 @@ struct _zend_property_info;
3636
#define ZEND_ENCODE_DYN_PROP_OFFSET(offset) ((uintptr_t)(-((intptr_t)(offset) + 2)))
3737

3838

39-
/* The following rule applies to read_property() and read_dimension() implementations:
40-
If you return a zval which is not otherwise referenced by the extension or the engine's
41-
symbol table, its reference count should be 0.
42-
*/
4339
/* Used to fetch property from the object, read-only */
4440
typedef zval *(*zend_object_read_property_t)(zend_object *object, zend_string *member, int type, void **cache_slot, zval *rv);
4541

0 commit comments

Comments
 (0)