Skip to content

Commit df93506

Browse files
committed
Merge branch 'PHP-7.3' into PHP-7.4
2 parents c896b3e + 4dc0662 commit df93506

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

Zend/zend_generators.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,7 @@ ZEND_API void zend_generator_close(zend_generator *generator, zend_bool finished
123123
/* always free the CV's, in the symtable are only not-free'd IS_INDIRECT's */
124124
zend_free_compiled_variables(execute_data);
125125

126-
if ((EX_CALL_INFO() & ZEND_CALL_RELEASE_THIS) &&
127-
EXPECTED(GC_TYPE(Z_OBJ(execute_data->This)) == IS_OBJECT)) {
126+
if (EX_CALL_INFO() & ZEND_CALL_RELEASE_THIS) {
128127
OBJ_RELEASE(Z_OBJ(execute_data->This));
129128
}
130129

@@ -144,8 +143,7 @@ ZEND_API void zend_generator_close(zend_generator *generator, zend_bool finished
144143
}
145144

146145
/* Free closure object */
147-
if ((EX_CALL_INFO() & ZEND_CALL_CLOSURE) &&
148-
EXPECTED(GC_TYPE(ZEND_CLOSURE_OBJECT(EX(func))) == IS_OBJECT)) {
146+
if (EX_CALL_INFO() & ZEND_CALL_CLOSURE) {
149147
OBJ_RELEASE(ZEND_CLOSURE_OBJECT(EX(func)));
150148
}
151149

Zend/zend_objects_API.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,17 @@ ZEND_API void ZEND_FASTCALL zend_objects_store_put(zend_object *object)
158158

159159
ZEND_API void ZEND_FASTCALL zend_objects_store_del(zend_object *object) /* {{{ */
160160
{
161+
ZEND_ASSERT(GC_REFCOUNT(object) == 0);
162+
163+
/* GC might have released this object already. */
164+
if (UNEXPECTED(GC_TYPE(object) == IS_NULL)) {
165+
return;
166+
}
167+
161168
/* Make sure we hold a reference count during the destructor call
162169
otherwise, when the destructor ends the storage might be freed
163170
when the refcount reaches 0 a second time
164171
*/
165-
ZEND_ASSERT(GC_REFCOUNT(object) == 0);
166-
167172
if (!(OBJ_FLAGS(object) & IS_OBJ_DESTRUCTOR_CALLED)) {
168173
GC_ADD_FLAGS(object, IS_OBJ_DESTRUCTOR_CALLED);
169174

0 commit comments

Comments
 (0)