summaryrefslogtreecommitdiff
path: root/ext/spl/spl_fixedarray.c
diff options
context:
space:
mode:
authorOndřej Surý <ondrej@sury.org>2013-01-21 14:07:09 +0100
committerOndřej Surý <ondrej@sury.org>2013-01-21 14:07:09 +0100
commit28f17d3b49950d50f3900f84d74d7cc0822b123d (patch)
treead028981f4d7690513d968ae373653ee8913a62e /ext/spl/spl_fixedarray.c
parent9036b58b9a461740c964cbcfa4493f0bcad435bd (diff)
downloadphp-upstream/5.4.11.tar.gz
Imported Upstream version 5.4.11upstream/5.4.11
Diffstat (limited to 'ext/spl/spl_fixedarray.c')
-rw-r--r--ext/spl/spl_fixedarray.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/ext/spl/spl_fixedarray.c b/ext/spl/spl_fixedarray.c
index 244bd3e0d..88bb7ae59 100644
--- a/ext/spl/spl_fixedarray.c
+++ b/ext/spl/spl_fixedarray.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2012 The PHP Group |
+ | Copyright (c) 1997-2013 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -147,13 +147,30 @@ static void spl_fixedarray_copy(spl_fixedarray *to, spl_fixedarray *from TSRMLS_
}
/* }}} */
+static HashTable* spl_fixedarray_object_get_gc(zval *obj, zval ***table, int *n TSRMLS_DC) /* {{{{ */
+{
+ spl_fixedarray_object *intern = (spl_fixedarray_object*)zend_object_store_get_object(obj TSRMLS_CC);
+ HashTable *ht = zend_std_get_properties(obj TSRMLS_CC);
+
+ if (intern->array) {
+ *table = intern->array->elements;
+ *n = intern->array->size;
+ } else {
+ *table = NULL;
+ *n = 0;
+ }
+
+ return ht;
+}
+/* }}}} */
+
static HashTable* spl_fixedarray_object_get_properties(zval *obj TSRMLS_DC) /* {{{{ */
{
spl_fixedarray_object *intern = (spl_fixedarray_object*)zend_object_store_get_object(obj TSRMLS_CC);
HashTable *ht = zend_std_get_properties(obj TSRMLS_CC);
int i = 0;
- if (intern->array && !GC_G(gc_active)) {
+ if (intern->array) {
int j = zend_hash_num_elements(ht);
for (i = 0; i < intern->array->size; i++) {
@@ -1091,6 +1108,7 @@ PHP_MINIT_FUNCTION(spl_fixedarray)
spl_handler_SplFixedArray.has_dimension = spl_fixedarray_object_has_dimension;
spl_handler_SplFixedArray.count_elements = spl_fixedarray_object_count_elements;
spl_handler_SplFixedArray.get_properties = spl_fixedarray_object_get_properties;
+ spl_handler_SplFixedArray.get_gc = spl_fixedarray_object_get_gc;
REGISTER_SPL_IMPLEMENTS(SplFixedArray, Iterator);
REGISTER_SPL_IMPLEMENTS(SplFixedArray, ArrayAccess);