|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #81279 Inconsistant parsing with simplexml_load_string function
Submitted: 2021-07-21 15:39 UTC Modified: 2021-07-22 08:04 UTC
From: a dot gargasas1238 at gmail dot com Assigned:
Status: Open Package: SimpleXML related
PHP Version: Irrelevant OS: irrelavant
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.
Block user comment
Status: Assign to:
Bug Type:
From: a dot gargasas1238 at gmail dot com
New email:
PHP Version: OS:


 [2021-07-21 15:39 UTC] a dot gargasas1238 at gmail dot com
bug appears in versions:
7.0.5 and later

Parsing XML string returns inconsistent values. When parsing single XML element with new lines (unix (\n) or win(\r\n)) resulting element will be array. When new line tags are removed element turns into object value.

Test script:

Expected result:
Consistent result of parsing element as object value, or as array

Actual result:
Inconsistent result: mix of object value and array


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2021-07-22 08:04 UTC]
Confirmed: <>.

The problem is that the whitespaces are parsed as text nodes, and
SimpleXML has known issues with mixed content, especially
regarding debug output (such as var_dump()).
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue May 28 18:01:32 2024 UTC