Merge branch 'PHP-7.3' into PHP-7.4

This commit is contained in:
Nikita Popov 2019-03-01 14:35:26 +01:00
commit df93506f56
2 changed files with 9 additions and 6 deletions

View file

@ -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);