From: timo dot schmid at gmail dot com
Operating system: Windows XP
PHP version: 5.0.4
PHP Bug Type: DOM XML related
Bug description: strange return value in get_elements_by_tagname()
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 bug report at http://bugs.php.net/?id=33573&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33573&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=33573&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=33573&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=33573&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=33573&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=33573&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=33573&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=33573&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=33573&r=support
Expected behavior: http://bugs.php.net/fix.php?id=33573&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=33573&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=33573&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=33573&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33573&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=33573&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=33573&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=33573&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=33573&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=33573&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=33573&r=mysqlcfg