php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67909 simplexml_load_string() mangles empty node name for specific xml structure
Submitted: 2014-08-26 15:24 UTC Modified: 2016-11-30 18:54 UTC
Votes:5
Avg. Score:3.6 ± 0.8
Reproduced:4 of 5 (80.0%)
Same Version:2 (50.0%)
Same OS:2 (50.0%)
From: evgeniy dot arsenyev at gmail dot com Assigned: cmb (profile)
Status: Duplicate Package: SimpleXML related
PHP Version: 5.5.16 OS: CENTOS 7
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:
28 + 39 = ?
Subscribe to this entry?

 
 [2014-08-26 15:24 UTC] evgeniy dot arsenyev at gmail dot com
Description:
------------
This bug is pretty similar to Bug #66084 :
simplexml_load_string() incorrectly interprets some XML strings. For specific inputs with empty nodes, node names are converted to integers.

Original bug was fixed, but the same bug appears on a slightly different XML string '<a><c><inner/></c><c><inner>ddd</inner></c></a>'.

Test script:
---------------
print_r(simplexml_load_string('<a><c><inner/></c><c><inner>ddd</inner></c></a>'));

Expected result:
----------------
SimpleXMLElement Object
(
    [c] => Array
        (
            [0] => SimpleXMLElement Object
                (
                    [inner] => SimpleXMLElement Object
                        (
                        )

                )

            [1] => SimpleXMLElement Object
                (
                    [inner] => dd
                )

        )

)

Actual result:
--------------
SimpleXMLElement Object
(
    [c] => Array
        (
            [0] => SimpleXMLElement Object
                (
                    [0] => SimpleXMLElement Object
                        (
                        )

                )

            [1] => SimpleXMLElement Object
                (
                    [inner] => ddd
                )

        )

)


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-11-30 18:54 UTC] cmb@php.net
-Status: Open +Status: Duplicate -Assigned To: +Assigned To: cmb
 [2016-11-30 18:54 UTC] cmb@php.net
This appears to be a duplicate of bug #66084, which has been fixed as of PHP 5.5.27 and 5.6.11, see <https://3v4l.org/6E90U>.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 13:01:30 2024 UTC