summaryrefslogtreecommitdiff
path: root/Zend/zend_generators.c
diff options
context:
space:
mode:
Diffstat (limited to 'Zend/zend_generators.c')
-rw-r--r--Zend/zend_generators.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c
index 90e5529f00..f4dd33b95c 100644
--- a/Zend/zend_generators.c
+++ b/Zend/zend_generators.c
@@ -145,7 +145,8 @@ ZEND_API void zend_generator_close(zend_generator *generator, zend_bool finished
}
/* Free closure object */
- if (EX_CALL_INFO() & ZEND_CALL_CLOSURE) {
+ if ((EX_CALL_INFO() & ZEND_CALL_CLOSURE) &&
+ EXPECTED(GC_TYPE(ZEND_CLOSURE_OBJECT(EX(func))) == IS_OBJECT)) {
OBJ_RELEASE(ZEND_CLOSURE_OBJECT(EX(func)));
}