summaryrefslogtreecommitdiff
path: root/ext/spl/tests/bug54971.phpt
blob: 22cdfba27b28c2fabb5655a44b83fb9a798d8c47 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
--TEST--
Bug #54971 (Wrong result when using iterator_to_array with use_keys on true)
--SKIPIF--
<?php
if (!extension_loaded('dom')) die("skip this test needs --enable-dom");
?>
--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(array_map('get_class', iterator_to_array($items, false)));
print_r(array_map('get_class', iterator_to_array($items, true)));
?>
--EXPECT--
Array
(
    [0] => DOMElement
    [1] => DOMElement
)
Array
(
    [0] => DOMElement
    [1] => DOMElement
)