|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28188 get_elements_by_tagname("text") return to many elements.
Submitted: 2004-04-27 20:20 UTC Modified: 2004-04-27 21:16 UTC
From: hans at deragon dot biz Assigned:
Status: Not a bug Package: DOM XML related
PHP Version: 4.3.4 OS: Red Hat Linux 9
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
45 - 17 = ?
Subscribe to this entry?

 [2004-04-27 20:20 UTC] hans at deragon dot biz
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:

    <lang code="default">Hardware clock set to UTC</lang>
    <lang code="fr">Horloge BIOS est UTC</lang>
  <widget type="checkbox">

Reproduce code:
    if(!$dom = domxml_open_file($filename))
      print "Could not open $filename";
    print "<pre>\n";
    print "</pre>\n";


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-04-27 21:16 UTC]
Thank you for taking the time to report a problem with PHP.
Unfortunately you are not using a current version of PHP -- 
the problem might already be fixed. Please download a new
PHP version from

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.

PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Sep 19 09:03:37 2021 UTC