Skip to content

Commit d46874f

Browse files
committed
So... the add_property_str() version unintentionally took ownership of the zend_string and released it
1 parent 247b33f commit d46874f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Zend/zend_API.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,9 +539,13 @@ static zend_always_inline void add_property_double_ex(zval *z_object, const char
539539
}
540540
static zend_always_inline void add_property_str(zval *z_object, const char *name, zend_string *value) {
541541
zend_update_property_str(Z_OBJCE_P(z_object), Z_OBJ_P(z_object), name, strlen(name), value);
542+
/* This legacy API assumed that the passed zend_string* would be freed */
543+
zend_string_release(value);
542544
}
543545
static zend_always_inline void add_property_str_ex(zval *z_object, const char *name, size_t name_length, zend_string *value) {
544546
zend_update_property_str(Z_OBJCE_P(z_object), Z_OBJ_P(z_object), name, name_length, value);
547+
/* This legacy API assumed that the passed zend_string* would be freed */
548+
zend_string_release(value);
545549
}
546550
static zend_always_inline void add_property_string(zval *z_object, const char *name, const char *value) {
547551
zend_update_property_string(Z_OBJCE_P(z_object), Z_OBJ_P(z_object), name, strlen(name), value);

0 commit comments

Comments
 (0)