diff options
author | David Coallier <davidc@php.net> | 2009-02-03 21:42:35 +0000 |
---|---|---|
committer | David Coallier <davidc@php.net> | 2009-02-03 21:42:35 +0000 |
commit | 0328eaea77f5992536676ef09eeb4de19c119cc1 (patch) | |
tree | 85f4bc6105f68f14f1e731defa6a561a5decb921 /ext/simplexml | |
parent | 59e6e127d25282157cdbed15c009609b6ca62fc2 (diff) | |
download | php-git-0328eaea77f5992536676ef09eeb4de19c119cc1.tar.gz |
- Fixed Bug #46048 (SimpleXML top-level @attributes not part of iterator)
- Added test for bug #46048
Diffstat (limited to 'ext/simplexml')
-rw-r--r-- | ext/simplexml/simplexml.c | 2 | ||||
-rw-r--r-- | ext/simplexml/tests/bug46048.phpt | 24 |
2 files changed, 25 insertions, 1 deletions
diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c index bb5bc6f31e..941aeeb648 100644 --- a/ext/simplexml/simplexml.c +++ b/ext/simplexml/simplexml.c @@ -1087,7 +1087,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-- +<?php +$xml = ' +<data id="1"> + <key>value</key> +</data> +'; +$obj = simplexml_load_string($xml); +print_r(get_object_vars($obj)); +echo "Done\n"; +?> +--EXPECT-- +Array +( + [@attributes] => Array + ( + [id] => 1 + ) + + [key] => value +) +Done |