From: David Coallier Date: Wed, 4 Feb 2009 00:07:27 +0000 (+0000) Subject: - MFB (Fixed Bug #46048: SimpleXML top-level @attributes not in iterator). X-Git-Tag: php-5.4.0alpha1~191^2~4333 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0050c92c91f3d2c572191e58ad46398027d6956c;p=php - MFB (Fixed Bug #46048: SimpleXML top-level @attributes not in iterator). --- diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c index 8e88e6e0ac..ba7aed44b2 100644 --- a/ext/simplexml/simplexml.c +++ b/ext/simplexml/simplexml.c @@ -1081,7 +1081,7 @@ static HashTable * sxe_get_prop_hash(zval *object, int is_debug TSRMLS_DC) /* {{ if (!node) { return rv; } - if (is_debug) { + if (is_debug || sxe->iter.type != SXE_ITER_CHILD) { if (sxe->iter.type == SXE_ITER_ELEMENT) { node = php_sxe_get_first_node(sxe, node TSRMLS_CC); } diff --git a/ext/simplexml/tests/bug46048.phpt b/ext/simplexml/tests/bug46048.phpt new file mode 100644 index 0000000000..e3eb4f5462 --- /dev/null +++ b/ext/simplexml/tests/bug46048.phpt @@ -0,0 +1,24 @@ +--TEST-- +Bug #46048 (SimpleXML top-level @attributes not part of iterator) +--FILE-- + + value + +'; +$obj = simplexml_load_string($xml); +print_r(get_object_vars($obj)); +echo "Done\n"; +?> +--EXPECT-- +Array +( + [@attributes] => Array + ( + [id] => 1 + ) + + [key] => value +) +Done