php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67474 getElementsByTagNameNS and default namespace
Submitted: 2014-06-19 09:02 UTC Modified: 2014-06-19 13:40 UTC
Votes:2
Avg. Score:4.0 ± 1.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:0 (0.0%)
From: pgtest at gmail dot com Assigned:
Status: Closed Package: DOM XML related
PHP Version: 5.5.13 OS: Windows 7 x64 SP1
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: pgtest at gmail dot com
New email:
PHP Version: OS:

 

 [2014-06-19 09:02 UTC] pgtest at gmail dot com
Description:
------------
When trying to get all elements from the default namespace (by providing an empty string first argument) getElementsByTagNameNS returns elements from ALL namespaces.

In the provided example, getElementsByTagNameNS should return only the first "a" element, not both.

Test script:
---------------
$doc = new DOMDocument();
$doc->loadXML('<root xmlns:x="x"><a/><x:a/></root>');
$list = $doc->getElementsByTagNameNS('', 'a');
echo $list->length;


Expected result:
----------------
1

Actual result:
--------------
2

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-06-19 12:57 UTC] pgtest at gmail dot com
Sorry, made a mistake with regards of actual behavior of getElementsByTagNameNS. The correct description would be:

When trying to get all elements from the default namespace (by providing an empty string first argument) getElementsByTagNameNS returns no elements.

Actual result: 0
 [2014-06-19 13:40 UTC] pgtest at gmail dot com
DOM documentation to consider with regard of expected getElementsByTagNameNS behavior:
http://www.w3.org/TR/dom/#concept-getelementsbytagnamens
http://www.w3.org/TR/dom/#concept-element-namespace
 [2016-12-22 10:55 UTC] arnoutboks at gmail dot com
I'm working on a patch for this bug.
 [2017-01-02 12:00 UTC] krakjoe@php.net
Automatic comment on behalf of arnoutboks@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=a8955926c2da6cb225edb92236e04ff9eb7cbcfa
Log: Fixed #67474 (getElementsByTagNameNS and default namespace)
 [2017-01-02 12:00 UTC] krakjoe@php.net
-Status: Open +Status: Closed
 [2017-01-02 12:00 UTC] krakjoe@php.net
Automatic comment on behalf of arnoutboks@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=a8955926c2da6cb225edb92236e04ff9eb7cbcfa
Log: Fixed #67474 (getElementsByTagNameNS and default namespace)
 [2017-01-02 12:01 UTC] krakjoe@php.net
Automatic comment on behalf of arnoutboks@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=a8955926c2da6cb225edb92236e04ff9eb7cbcfa
Log: Fixed #67474 (getElementsByTagNameNS and default namespace)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 03:01:28 2024 UTC