Bug #54971 [Opn->Ver]: wrong result with DOMNodeList and iterator_to_array use_keys

From: Date: Fri, 03 Jun 2011 01:49:28 +0000
Subject: Bug #54971 [Opn->Ver]: wrong result with DOMNodeList and iterator_to_array use_keys
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-161148@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=54971&edit=1 ID: 54971 Updated by: felipe@php.net Reported by: jinmoku at hotmail dot com Summary: wrong result with DOMNodeList and iterator_to_array use_keys -Status: Open +Status: Verified Type: Bug Package: DOM XML related Operating System: Win 7 PHP Version: 5.3.6 Block user comment: N Private report: N Previous Comments: ------------------------------------------------------------------------ [2011-06-01 16:12:34] jinmoku at hotmail dot com Description: ------------ when you pass a DOMNodeList in iterator_to_array there a weird result with use_keys on true Test script: --------------- $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, true)); print_r(iterator_to_array($items, false)); Expected result: ---------------- Array ( [0] => DOMElement Object ( ) [1] => DOMElement Object ( ) ) Array ( [0] => DOMElement Object ( ) [1] => DOMElement Object ( ) ) Actual result: -------------- Array ( [6646882] => DOMElement Object ( ) ) Array ( [0] => DOMElement Object ( ) [1] => DOMElement Object ( ) ) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=54971&edit=1

« previous php.bugs (#161148) next »