From: hans at deragon dot biz Operating system: Red Hat Linux 9 PHP version: 4.3.4 PHP Bug Type: DOM XML related Bug description: get_elements_by_tagname("text") return to many elements.
Description: ------------ When executing $node->get_elements_by_tagname("text"); it is not only the tag named "text" that is returned, but all tags named "#text". This is wrong. I am searching for all "text" nodes that are to be found in the input xml file, not those who are named #text and are domtext elements. Why do domtext element have a name and why are they returned? The documentation for states "Every element of the array is an DomElement.". Not true as DomText are returned too. Here is the input file "get_elements_by_tagname.xml" used for the test: <section> <text> <lang code="default">Hardware clock set to UTC</lang> <lang code="fr">Horloge BIOS est UTC</lang> </text> <widget type="checkbox"> <default>off</default> </widget> </section> Reproduce code: --------------- <?php $filename="get_elements_by_tagname.xml"; if(!$dom = domxml_open_file($filename)) { print "Could not open $filename"; return; } $root=$dom->document_element(); $textnodes=$root->get_elements_by_tagname("text"); print "<pre>\n"; print_r($textnodes); print "</pre>\n"; ?> -- Edit bug report at http://bugs.php.net/?id=28188&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=28188&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=28188&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=28188&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=28188&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=28188&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=28188&r=needscript Try newer version: http://bugs.php.net/fix.php?id=28188&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=28188&r=support Expected behavior: http://bugs.php.net/fix.php?id=28188&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=28188&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=28188&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=28188&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28188&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=28188&r=dst IIS Stability: http://bugs.php.net/fix.php?id=28188&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=28188&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=28188&r=float