Permalink
Browse files

Add GC support for ArrayObject

gc_024 test changes because the array that ArrayObject holds is
now counted separately from the ArrayObject.
  • Loading branch information...
nikic committed Apr 16, 2015
1 parent 4ea1d8a commit 4e03ba4a6ef4c16b53e49e32eb4992a797ae08a8
Showing with 11 additions and 1 deletion.
  1. +1 −1 Zend/tests/gc_024.phpt
  2. +10 −0 ext/spl/spl_array.c
@@ -13,5 +13,5 @@ var_dump(gc_collect_cycles());
echo "ok\n";
?>
--EXPECT--
int(1)
int(2)
ok
@@ -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;

0 comments on commit 4e03ba4

Please sign in to comment.