summaryrefslogtreecommitdiff
path: root/ext/spl/tests/bug54971.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'ext/spl/tests/bug54971.phpt')
-rw-r--r--ext/spl/tests/bug54971.phpt45
1 files changed, 45 insertions, 0 deletions
diff --git a/ext/spl/tests/bug54971.phpt b/ext/spl/tests/bug54971.phpt
new file mode 100644
index 000000000..166613b43
--- /dev/null
+++ b/ext/spl/tests/bug54971.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Bug #54971 (Wrong result when using iterator_to_array with use_keys on true)
+--FILE--
+<?php
+
+$source = <<<XML
+<root>
+<node>val1</node>
+<node>val2</node>
+</root>
+XML;
+
+
+$doc = new DOMDocument();
+$doc->loadXML($source);
+
+$xpath = new DOMXPath($doc);
+$items = $xpath->query('//node');
+
+print_r(iterator_to_array($items, false));
+print_r(iterator_to_array($items, true));
+?>
+--EXPECT--
+Array
+(
+ [0] => DOMElement Object
+ (
+ )
+
+ [1] => DOMElement Object
+ (
+ )
+
+)
+Array
+(
+ [0] => DOMElement Object
+ (
+ )
+
+ [1] => DOMElement Object
+ (
+ )
+
+)