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
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
44 - 15 = ?
Subscribe to this entry?

 
 [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: Fri Apr 26 20:01:29 2024 UTC