From: Marcus Boerger Date: Fri, 14 Apr 2006 15:19:45 +0000 (+0000) Subject: - MFH Fix properties access to children() result X-Git-Tag: php-5.1.3RC3~26 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=011266f7e13c566badef46f83d20d996f211b38e;p=php - MFH Fix properties access to children() result --- diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c index 99d16d7790..a51b4804ea 100644 --- a/ext/simplexml/simplexml.c +++ b/ext/simplexml/simplexml.c @@ -989,7 +989,7 @@ static HashTable * sxe_properties_get(zval *object TSRMLS_DC) ZVAL_STRING(value, sxe_xmlNodeListGetString(node->doc, node->children, 1), 0); zend_hash_next_index_insert(rv, &value, sizeof(zval *), NULL); node = NULL; - } else { + } else if (sxe->iter.type != SXE_ITER_CHILD) { node = node->children; } diff --git a/ext/simplexml/tests/009b.phpt b/ext/simplexml/tests/009b.phpt new file mode 100755 index 0000000000..dba300c72f --- /dev/null +++ b/ext/simplexml/tests/009b.phpt @@ -0,0 +1,35 @@ +--TEST-- +SimpleXML: foreach +--SKIPIF-- + +--FILE-- + + + + Plain text. + Bla bla 1. + Here we have some text data. + + Bla bla 2. + +EOF +); +var_dump($sxe->children()); +?> +===DONE=== + +--EXPECTF-- +object(SimpleXMLElement)#%d (3) { + ["@attributes"]=> + array(1) { + ["id"]=> + string(5) "elem1" + } + ["elem1"]=> + string(10) "Bla bla 1." + ["elem11"]=> + string(10) "Bla bla 2." +} +===DONE===