|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37685 Namespaced elements completely ignored
Submitted: 2006-06-03 01:53 UTC Modified: 2006-06-14 23:49 UTC
From: Assigned:
Status: Not a bug Package: SimpleXML related
PHP Version: 5.1.4 OS: Linux
Private report: No CVE-ID: None
 [2006-06-03 01:53 UTC]
I am not sure if this is an actual bug or intended 
behavior, but there seems to be a BC break in SimpleXML 
regarding namespaced elements. 
I had a script which worked under 5.1.0, but after 
upgrading to 5.1.4, it broke. I have not tested it under 
Previously, (and according to most documentation and things 
I have read, namespaces are ignored, but the element will 
still be loaded in the SimpleXML element. Under 5.1.4, it 
seems namespaced elements are completely ignored. 

Reproduce code:
$xml = '<root xmlns:baz=""><foo>Hello</foo><baz:bar>World</baz:bar></root>';
$xml = simplexml_load_string($xml);

Expected result:
This was the output in 5.1.0. 
SimpleXMLElement Object 
    [foo] => Hello 
    [bar] => World 

Actual result:
Output in 5.1.4 (and possibly .1-.3, I haven't tested). 
SimpleXMLElement Object  
    [foo] => Hello  


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-06-14 23:49 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

This was changed so print_r/var_dump respect namespace of initial object - results now the same as if accessing the subtree using ->children()
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Jun 19 04:01:31 2024 UTC