com php-src: Add GC support for ArrayObject: Zend/tests/gc_ 024.phpt ext/spl/spl_array.c
| From: | Nikita Popov | Date: | Wed, 20 May 2015 16:28:09 +0000 |
| Subject: | com php-src: Add GC support for ArrayObject: Zend/tests/gc_ 024.phpt ext/spl/spl_array.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-86824@lists.php.net to get a copy of this message | ||
Commit: 4e03ba4a6ef4c16b53e49e32eb4992a797ae08a8
Author: Nikita Popov <nikic@php.net> Thu, 16 Apr 2015 10:07:41 +0200
Parents: 4ea1d8a9c7f7a2292db720e61799656511df2c61
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=4e03ba4a6ef4c16b53e49e32eb4992a797ae08a8
Log:
Add GC support for ArrayObject
gc_024 test changes because the array that ArrayObject holds is
now counted separately from the ArrayObject.
Changed paths:
M Zend/tests/gc_024.phpt
M ext/spl/spl_array.c
Diff:
diff --git a/Zend/tests/gc_024.phpt b/Zend/tests/gc_024.phpt
index 9a2ceb8..ca78da6 100644
--- a/Zend/tests/gc_024.phpt
+++ b/Zend/tests/gc_024.phpt
@@ -13,5 +13,5 @@ var_dump(gc_collect_cycles());
echo "ok\n";
?>
--EXPECT--
-int(1)
+int(2)
ok
diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c
index c56e2d5..4ade06a 100644
--- a/ext/spl/spl_array.c
+++ b/ext/spl/spl_array.c
@@ -831,6 +831,15 @@ static HashTable* spl_array_get_debug_info(zval *obj, int *is_temp) /* {{{ */
}
/* }}} */
+static HashTable *spl_array_get_gc(zval *obj, zval **gc_data, int *gc_data_count) /* {{{ */
+{
+ spl_array_object *intern = Z_SPLARRAY_P(obj);
+ *gc_data = &intern->array;
+ *gc_data_count = 1;
+ return zend_std_get_properties(obj);
+}
+/* }}} */
+
static zval *spl_array_read_property(zval *object, zval *member, int type, void **cache_slot, zval
*rv) /* {{{ */
{
spl_array_object *intern = Z_SPLARRAY_P(object);
@@ -1913,6 +1922,7 @@ PHP_MINIT_FUNCTION(spl_array)
spl_handler_ArrayObject.get_properties = spl_array_get_properties;
spl_handler_ArrayObject.get_debug_info = spl_array_get_debug_info;
+ spl_handler_ArrayObject.get_gc = spl_array_get_gc;
spl_handler_ArrayObject.read_property = spl_array_read_property;
spl_handler_ArrayObject.write_property = spl_array_write_property;
spl_handler_ArrayObject.get_property_ptr_ptr = spl_array_get_property_ptr_ptr;