Skip to content

Commit 758ca01

Browse files
committed
We don't have to clear zend_object structure, it's initialized by zend_object_std_init() anyway.
1 parent f323baa commit 758ca01

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

Zend/zend_objects_API.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,12 @@ static zend_always_inline size_t zend_object_properties_size(zend_class_entry *c
8585
((ce->ce_flags & ZEND_ACC_USE_GUARDS) ? 0 : 1));
8686
}
8787

88-
/* Allocates object type and zeros it, but not the properties.
88+
/* Allocates object type and zeros it, but not the standard zend_object and properties.
89+
* Standard object MUST be initialized using zend_object_std_init().
8990
* Properties MUST be initialized using object_properties_init(). */
9091
static zend_always_inline void *zend_object_alloc(size_t obj_size, zend_class_entry *ce) {
9192
void *obj = emalloc(obj_size + zend_object_properties_size(ce));
92-
/* Subtraction of sizeof(zval) is necessary, because zend_object_properties_size() may be
93-
* -sizeof(zval), if the object has no properties. */
94-
memset(obj, 0, obj_size - sizeof(zval));
93+
memset(obj, 0, obj_size - sizeof(zend_object));
9594
return obj;
9695
}
9796

0 commit comments

Comments
 (0)