#33573 [Fbk->Bgs]: strange return value in get_elements_by_tagname()

From: Date: Mon, 11 Jul 2005 13:03:58 +0000
Subject: #33573 [Fbk->Bgs]: strange return value in get_elements_by_tagname()
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-81673@lists.php.net to get a copy of this message
ID: 33573 Updated by: chregu@php.net Reported By: timo dot schmid at gmail dot com -Status: Feedback +Status: Bogus Bug Type: DOM XML related Operating System: Windows XP PHP Version: 5.0.4 New Comment: you have to "db" elements below the $root element. So this is expected behaviour. Previous Comments: ------------------------------------------------------------------------ [2005-07-05 12:50:35] tony2001@php.net Please try using this CVS snapshot: http://snaps.php.net/php5-latest.tar.gz For Windows: http://snaps.php.net/win32/php5-win32-latest.zip ------------------------------------------------------------------------ [2005-07-05 11:58:35] timo dot schmid at gmail dot com Description: ------------ The function seems to return a the DB-Object twice. One of the Objects is valid, the other is missing data. Reproduce code: --------------- <?php $xml = '<?xml version="1.0" encoding="UTF-8"?> <settings> <db> <user>root</user> <pw>topsecret</pw> <host>localhost</host> <type>mysql</type> <db>mydatabase</db> <fetchmode>3</fetchmode> <autocommit>on</autocommit> </db> </settings>'; $dom = new DomDocument($xml); $root = $dom->document_element(); print '<pre>'; var_dump($root->get_elements_by_tagname('db')); print '</pre>'; ?> Expected result: ---------------- array(1) { [0]=> object(domelement)#3 (4) { ["type"]=> int(1) ["tagname"]=> string(2) "db" [0]=> int(4) [1]=> int(22694840) } } or something similar... Actual result: -------------- array(2) { [0]=> object(domelement)#3 (4) { ["type"]=> int(1) ["tagname"]=> string(2) "db" [0]=> int(4) [1]=> int(22694840) } [1]=> object(domelement)#4 (4) { ["type"]=> int(1) ["tagname"]=> string(2) "db" [0]=> int(5) [1]=> int(22693552) } } ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=33573&edit=1

« previous php.bugs (#81673) next »