summaryrefslogtreecommitdiff
path: root/ext/simplexml/simplexml.c
diff options
context:
space:
mode:
authorMarcus Boerger <helly@php.net>2006-02-27 13:38:03 +0000
committerMarcus Boerger <helly@php.net>2006-02-27 13:38:03 +0000
commitc5d70528d72b5840dc3bf7fbf01d74eb22377ae7 (patch)
tree07cbd9a6a474e5e2d3c1a361d2bb55135a2c1626 /ext/simplexml/simplexml.c
parent44d4ba478fead6c61226d50cf7bee2b7c091c213 (diff)
downloadphp-git-c5d70528d72b5840dc3bf7fbf01d74eb22377ae7.tar.gz
- MFH Fix count/foreach interaction
Diffstat (limited to 'ext/simplexml/simplexml.c')
-rw-r--r--ext/simplexml/simplexml.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c
index 05b7f11c9b..e8150eaf98 100644
--- a/ext/simplexml/simplexml.c
+++ b/ext/simplexml/simplexml.c
@@ -1438,9 +1438,14 @@ static int sxe_count_elements(zval *object, long *count TSRMLS_DC) /* {{{ */
{
php_sxe_object *sxe;
xmlNodePtr node;
+ zval *data;
*count = 0;
sxe = php_sxe_fetch_object(object TSRMLS_CC);
+
+ data = sxe->iter.data;
+ sxe->iter.data = NULL;
+
node = php_sxe_reset_iterator(sxe, 0 TSRMLS_CC);
while (node)
@@ -1450,6 +1455,11 @@ static int sxe_count_elements(zval *object, long *count TSRMLS_DC) /* {{{ */
}
+ if (sxe->iter.data) {
+ zval_ptr_dtor(&sxe->iter.data);
+ }
+ sxe->iter.data = data;
+
return SUCCESS;
}
/* }}} */