From 758ca0198e551ccb1ae2933334bb8261bb678352 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Fri, 2 Apr 2021 16:11:34 +0300 Subject: [PATCH] We don't have to clear zend_object structure, it's initialized by zend_object_std_init() anyway. --- Zend/zend_objects_API.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Zend/zend_objects_API.h b/Zend/zend_objects_API.h index 539850f227b..7a9a3a00082 100644 --- a/Zend/zend_objects_API.h +++ b/Zend/zend_objects_API.h @@ -85,13 +85,12 @@ static zend_always_inline size_t zend_object_properties_size(zend_class_entry *c ((ce->ce_flags & ZEND_ACC_USE_GUARDS) ? 0 : 1)); } -/* Allocates object type and zeros it, but not the properties. +/* Allocates object type and zeros it, but not the standard zend_object and properties. + * Standard object MUST be initialized using zend_object_std_init(). * Properties MUST be initialized using object_properties_init(). */ static zend_always_inline void *zend_object_alloc(size_t obj_size, zend_class_entry *ce) { void *obj = emalloc(obj_size + zend_object_properties_size(ce)); - /* Subtraction of sizeof(zval) is necessary, because zend_object_properties_size() may be - * -sizeof(zval), if the object has no properties. */ - memset(obj, 0, obj_size - sizeof(zval)); + memset(obj, 0, obj_size - sizeof(zend_object)); return obj; }