|  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: hans at deragon dot biz
New email:
PHP Version: OS:


 [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 08:03:37 2021 UTC