summaryrefslogtreecommitdiff
path: root/ext/spl/spl_observer.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/spl/spl_observer.c')
-rw-r--r--ext/spl/spl_observer.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/ext/spl/spl_observer.c b/ext/spl/spl_observer.c
index de33bd5a6b..e9dc418b53 100644
--- a/ext/spl/spl_observer.c
+++ b/ext/spl/spl_observer.c
@@ -295,8 +295,7 @@ static HashTable* spl_object_storage_debug_info(zval *obj, int *is_temp) /* {{{
props = Z_OBJPROP_P(obj);
- ALLOC_HASHTABLE(debug_info);
- ZEND_INIT_SYMTABLE_EX(debug_info, zend_hash_num_elements(props) + 1, 0);
+ debug_info = zend_new_array(zend_hash_num_elements(props) + 1);
zend_hash_copy(debug_info, props, (copy_ctor_func_t)zval_add_ref);
array_init(&storage);
@@ -570,12 +569,13 @@ SPL_METHOD(SplObjectStorage, count)
}
if (mode == COUNT_RECURSIVE) {
- zend_long ret = zend_hash_num_elements(&intern->storage);
- zval *element;
+ zend_long ret;
- ZEND_HASH_FOREACH_VAL(&intern->storage, element) {
- ret += php_count_recursive(element, mode);
- } ZEND_HASH_FOREACH_END();
+ if (mode != COUNT_RECURSIVE) {
+ ret = zend_hash_num_elements(&intern->storage);
+ } else {
+ ret = php_count_recursive(&intern->storage);
+ }
RETURN_LONG(ret);
return;