From:
Operating system:
PHP version: 5.3.2
Package: DOM XML related
Bug Type: Bug
Bug description:getElementsByTagName always return an empty list
Description:
------------
$document = new DOMDocument()->load(...);
$document->getElementsByTagName(<root element name>) works (returns list
with one element).
getElementsByTagName(<non root element name>) always return an empty list.
Examples on notes and on the web (some examples claimed to be working are
prior the 5.3.2) are all not working.
Tested on LAMP server PHP 5.2.8 AND on XAMPPLite WAMP PHP 5.3.1, both not
working.
Test script:
---------------
$doc = new DOMDocument();
$doc->load('__xml/faq.xml');
$faqs = $doc->getElementsByTagName("faq");
echo $faqs->length; // always 0
__xml/faq.xml is:
<?xml version="1.0" encoding="iso-8859-1"?>
<faqs>
<faq>
<domanda>domanda1</domanda>
<risposta>risposta1</risposta>
</faq>
<faq>
<domanda>domanda2</domanda>
<risposta>risposta2</risposta>
</faq>
<faq>
<domanda>domanda3</domanda>
<risposta>risposta3</risposta>
</faq>
</faqs>
--
Edit bug report at http://bugs.php.net/bug.php?id=51235&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=51235&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=51235&r=trysnapshot53
Try a snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=51235&r=trysnapshot60
Fixed in SVN:
http://bugs.php.net/fix.php?id=51235&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=51235&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=51235&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=51235&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=51235&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=51235&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=51235&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=51235&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=51235&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=51235&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=51235&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=51235&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=51235&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=51235&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=51235&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=51235&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=51235&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=51235&r=mysqlcfg