bug54971.phpt 566 B

1234567891011121314151617181920212223242526272829303132333435
  1. --TEST--
  2. Bug #54971 (Wrong result when using iterator_to_array with use_keys on true)
  3. --EXTENSIONS--
  4. dom
  5. --FILE--
  6. <?php
  7. $source = <<<XML
  8. <root>
  9. <node>val1</node>
  10. <node>val2</node>
  11. </root>
  12. XML;
  13. $doc = new DOMDocument();
  14. $doc->loadXML($source);
  15. $xpath = new DOMXPath($doc);
  16. $items = $xpath->query('//node');
  17. print_r(array_map('get_class', iterator_to_array($items, false)));
  18. print_r(array_map('get_class', iterator_to_array($items, true)));
  19. ?>
  20. --EXPECT--
  21. Array
  22. (
  23. [0] => DOMElement
  24. [1] => DOMElement
  25. )
  26. Array
  27. (
  28. [0] => DOMElement
  29. [1] => DOMElement
  30. )