php.net |  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: mfonda@php.net Assigned:
Status: Not a bug Package: SimpleXML related
PHP Version: 5.1.4 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: mfonda@php.net
New email:
PHP Version: OS:

 

 [2006-06-03 01:53 UTC] mfonda@php.net
Description:
------------
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 
5.1.1-5.1.3. 
 
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:
---------------
<?php
$xml = '<root xmlns:baz="http://baz.com"><foo>Hello</foo><baz:bar>World</baz:bar></root>';
$xml = simplexml_load_string($xml);
print_r($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  
)  
  

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

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

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: Sat Jun 15 04:01:30 2024 UTC