From: z_rules55 at hotmail dot com
Operating system: WinXP Professional
PHP version: 5.2.0
PHP Bug Type: DOM XML related
Bug description: getElementsByTagNameNS() does not return elements in a
default namespace
Description:
------------
Calling getElementsByTagNameNS() on a DOMDocument or a DOMElement does not
return elements that are under a default namespace. The example below finds
$explicit_ns_element, but not $default_ns_element.
Reproduce code:
---------------
<?php
$xml = new DOMDocument();
$namespace = 'my_namespace';
$root = $xml->appendChild($xml->createElementNS($namespace, 'root'));
$default_ns_element = $root->appendChild($xml->createElement('element',
'default_ns_element'));
$explicit_ns_element =
$root->appendChild($xml->createElementNS($namespace, 'element',
'explicit_ns_element'));
foreach($xml->getElementsByTagNameNS($namespace, 'element') as $el) {
echo $el->nodeValue."\n";
}
echo "\n";
foreach($root->getElementsByTagNameNS($namespace, 'element') as $el) {
echo $el->nodeValue."\n";
}
?>
Expected result:
----------------
default_ns_element
explicit_ns_element
default_ns_element
explicit_ns_element
Actual result:
--------------
explicit_ns_element
explicit_ns_element
--
Edit bug report at http://bugs.php.net/?id=39365&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=39365&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=39365&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=39365&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=39365&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=39365&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=39365&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=39365&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=39365&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=39365&r=support
Expected behavior: http://bugs.php.net/fix.php?id=39365&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=39365&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=39365&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=39365&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=39365&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=39365&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=39365&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=39365&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=39365&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=39365&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=39365&r=mysqlcfg