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);
}
--- /dev/null
+--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