diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2019-03-01 14:35:26 +0100 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2019-03-01 14:35:26 +0100 |
commit | df93506f5652b220b03b169ac64d6f85605b705e (patch) | |
tree | 81a84103cb0f5c480374d819ba9189b3665b739e | |
parent | c896b3ea482d928aa9ca876fedfefda7bfb06565 (diff) | |
parent | 4dc0662eca4d8bc79cb6f6fa0c62e1600efef78a (diff) | |
download | php-git-df93506f5652b220b03b169ac64d6f85605b705e.tar.gz |
Merge branch 'PHP-7.3' into PHP-7.4
-rw-r--r-- | Zend/zend_generators.c | 6 | ||||
-rw-r--r-- | Zend/zend_objects_API.c | 9 |
2 files changed, 9 insertions, 6 deletions
diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c index 9e7e5fe28f..a59d84cda7 100644 --- a/Zend/zend_generators.c +++ b/Zend/zend_generators.c @@ -123,8 +123,7 @@ ZEND_API void zend_generator_close(zend_generator *generator, zend_bool finished /* always free the CV's, in the symtable are only not-free'd IS_INDIRECT's */ zend_free_compiled_variables(execute_data); - if ((EX_CALL_INFO() & ZEND_CALL_RELEASE_THIS) && - EXPECTED(GC_TYPE(Z_OBJ(execute_data->This)) == IS_OBJECT)) { + if (EX_CALL_INFO() & ZEND_CALL_RELEASE_THIS) { OBJ_RELEASE(Z_OBJ(execute_data->This)); } @@ -144,8 +143,7 @@ ZEND_API void zend_generator_close(zend_generator *generator, zend_bool finished } /* Free closure object */ - if ((EX_CALL_INFO() & ZEND_CALL_CLOSURE) && - EXPECTED(GC_TYPE(ZEND_CLOSURE_OBJECT(EX(func))) == IS_OBJECT)) { + if (EX_CALL_INFO() & ZEND_CALL_CLOSURE) { OBJ_RELEASE(ZEND_CLOSURE_OBJECT(EX(func))); } diff --git a/Zend/zend_objects_API.c b/Zend/zend_objects_API.c index efd8492c7b..9a55b7d153 100644 --- a/Zend/zend_objects_API.c +++ b/Zend/zend_objects_API.c @@ -158,12 +158,17 @@ ZEND_API void ZEND_FASTCALL zend_objects_store_put(zend_object *object) ZEND_API void ZEND_FASTCALL zend_objects_store_del(zend_object *object) /* {{{ */ { + ZEND_ASSERT(GC_REFCOUNT(object) == 0); + + /* GC might have released this object already. */ + if (UNEXPECTED(GC_TYPE(object) == IS_NULL)) { + return; + } + /* Make sure we hold a reference count during the destructor call otherwise, when the destructor ends the storage might be freed when the refcount reaches 0 a second time */ - ZEND_ASSERT(GC_REFCOUNT(object) == 0); - if (!(OBJ_FLAGS(object) & IS_OBJ_DESTRUCTOR_CALLED)) { GC_ADD_FLAGS(object, IS_OBJ_DESTRUCTOR_CALLED); |