|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67901 getElementsByTagname('link') does not work
Submitted: 2014-08-25 13:37 UTC Modified: 2014-08-25 21:36 UTC
From: noxtras at gmail dot com Assigned:
Status: Not a bug Package: DOM XML related
PHP Version: 5.4.32 OS: Centos
Private report: No CVE-ID: None
 [2014-08-25 13:37 UTC] noxtras at gmail dot com
From manual page:
There is a difference between

the second one returns am empty string!

Test script:
$xml = file_get_contents('');
$dom = new domDocument;
$dom->preserveWhiteSpace = false;
$items = $dom->getElementsByTagname('item');
foreach ($items as $k=>$node) {	
 //this works
    echo '<br>link: ' . $node->getElementsByTagname("link")->item(0)->textContent;
 //this does NOT work (returns empty string
    echo '<br>link: ' . $node->getElementsByTagname('link')->item(0)->textContent;


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2014-08-25 21:36 UTC]
-Status: Open +Status: Not a bug
 [2014-08-25 21:36 UTC]
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

I can assure you that the quoting style makes absolutely no difference between 'link' and "link". Maybe you're using a variable instead of a literal value?
Keep checking your code for bugs.
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sat Sep 19 20:01:33 2020 UTC