From e0f781f4967a937c787ab682907b6d6c48dcba6f Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Wed, 2 Nov 2011 06:31:33 +0000 Subject: Fixed bug #60139 (Anonymous functions create cycles not detected by the GC) --- Zend/zend_object_handlers.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'Zend/zend_object_handlers.c') diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c index 77fdea3e62..b43021dd22 100644 --- a/Zend/zend_object_handlers.c +++ b/Zend/zend_object_handlers.c @@ -102,6 +102,28 @@ ZEND_API HashTable *zend_std_get_properties(zval *object TSRMLS_DC) /* {{{ */ } /* }}} */ +ZEND_API HashTable *zend_std_get_gc(zval *object, zval ***table, int *n TSRMLS_DC) /* {{{ */ +{ + if (Z_OBJ_HANDLER_P(object, get_properties) != zend_std_get_properties) { + *table = NULL; + *n = 0; + return Z_OBJ_HANDLER_P(object, get_properties)(object TSRMLS_CC); + } else { + zend_object *zobj = Z_OBJ_P(object); + + if (zobj->properties) { + *table = NULL; + *n = 0; + return zobj->properties; + } else { + *table = zobj->properties_table; + *n = zobj->ce->default_properties_count; + return NULL; + } + } +} +/* }}} */ + ZEND_API HashTable *zend_std_get_debug_info(zval *object, int *is_temp TSRMLS_DC) /* {{{ */ { *is_temp = 0; @@ -1584,6 +1606,7 @@ ZEND_API zend_object_handlers std_object_handlers = { NULL, /* count_elements */ NULL, /* get_debug_info */ zend_std_get_closure, /* get_closure */ + zend_std_get_gc, /* get_gc */ }; /* -- cgit v1.2.1