Skip to content

File tree

3 files changed

+8
-56
lines changed

3 files changed

+8
-56
lines changed

UPGRADING.INTERNALS

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ PHP 8.3 INTERNALS UPGRADE NOTES
7676
- add_property_array_ex()
7777
- add_property_object_ex()
7878
- add_property_reference_ex()
79-
As there exists no equivalent.
79+
Which have been removed, use zend_update_property() and wrap the value in
80+
a zval* manually.
8081
It is recommended to convert these usages to the zend_update_property_TYPE()
8182
functions.
8283

Zend/zend_API.c

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2115,46 +2115,6 @@ ZEND_API zend_result array_set_zval_key(HashTable *ht, zval *key, zval *value) /
21152115
}
21162116
/* }}} */
21172117

2118-
ZEND_API void add_property_resource_ex(zval *arg, const char *key, size_t key_len, zend_resource *r) /* {{{ */
2119-
{
2120-
zval tmp;
2121-
2122-
ZVAL_RES(&tmp, r);
2123-
add_property_zval_ex(arg, key, key_len, &tmp);
2124-
zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */
2125-
}
2126-
/* }}} */
2127-
2128-
ZEND_API void add_property_array_ex(zval *arg, const char *key, size_t key_len, zend_array *arr) /* {{{ */
2129-
{
2130-
zval tmp;
2131-
2132-
ZVAL_ARR(&tmp, arr);
2133-
add_property_zval_ex(arg, key, key_len, &tmp);
2134-
zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */
2135-
}
2136-
/* }}} */
2137-
2138-
ZEND_API void add_property_object_ex(zval *arg, const char *key, size_t key_len, zend_object *obj) /* {{{ */
2139-
{
2140-
zval tmp;
2141-
2142-
ZVAL_OBJ(&tmp, obj);
2143-
add_property_zval_ex(arg, key, key_len, &tmp);
2144-
zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */
2145-
}
2146-
/* }}} */
2147-
2148-
ZEND_API void add_property_reference_ex(zval *arg, const char *key, size_t key_len, zend_reference *ref) /* {{{ */
2149-
{
2150-
zval tmp;
2151-
2152-
ZVAL_REF(&tmp, ref);
2153-
add_property_zval_ex(arg, key, key_len, &tmp);
2154-
zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */
2155-
}
2156-
/* }}} */
2157-
21582118
ZEND_API zend_result zend_startup_module_ex(zend_module_entry *module) /* {{{ */
21592119
{
21602120
size_t name_len;

Zend/zend_API.h

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -559,22 +559,13 @@ static zend_always_inline void add_property_stringl(zval *z_object, const char *
559559
static zend_always_inline void add_property_stringl_ex(zval *z_object, const char *name, size_t name_length, const char *value, size_t value_len) {
560560
zend_update_property_stringl(Z_OBJCE_P(z_object), Z_OBJ_P(z_object), name, name_length, value, value_len);
561561
}
562+
/* Resource variant only has non ex version as it is rarely used */
563+
static zend_always_inline void add_property_resource(zval *z_object, const char *name, zend_resource *resource) {
564+
zval tmp;
562565

563-
ZEND_API void add_property_resource_ex(zval *arg, const char *key, size_t key_len, zend_resource *r);
564-
ZEND_API void add_property_array_ex(zval *arg, const char *key, size_t key_len, zend_array *arr);
565-
ZEND_API void add_property_object_ex(zval *arg, const char *key, size_t key_len, zend_object *obj);
566-
ZEND_API void add_property_reference_ex(zval *arg, const char *key, size_t key_len, zend_reference *ref);
567-
static zend_always_inline void add_property_resource(zval *arg, const char *key, zend_resource *r) {
568-
add_property_resource_ex(arg, key, strlen(key), r);
569-
}
570-
static zend_always_inline void add_property_array(zval *arg, const char *key, zend_array *arr) {
571-
add_property_array_ex(arg, key, strlen(key), arr);
572-
}
573-
static zend_always_inline void add_property_object(zval *arg, const char *key, zend_object *obj) {
574-
add_property_object_ex(arg, key, strlen(key), obj);
575-
}
576-
static zend_always_inline void add_property_reference(zval *arg, const char *key, zend_reference *ref) {
577-
add_property_reference_ex(arg, key, strlen(key), ref);
566+
ZVAL_RES(&tmp, resource);
567+
zend_update_property(Z_OBJCE_P(z_object), Z_OBJ_P(z_object), name, strlen(name), &tmp);
568+
zval_ptr_dtor(&tmp); /* Updating property will increase refcount by 1 */
578569
}
579570

580571
ZEND_API zend_result zend_update_static_property_ex(zend_class_entry *scope, zend_string *name, zval *value);

0 commit comments

Comments
 (0)