php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71526 SimpleXML different results with whitespace
Submitted: 2016-02-04 22:14 UTC Modified: 2016-11-27 14:18 UTC
Votes:2
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: jacob dot mroz at gmail dot com Assigned: cmb (profile)
Status: Duplicate Package: SimpleXML related
PHP Version: 5.5.32 OS: CentOS release 6.7 (Final)
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: jacob dot mroz at gmail dot com
New email:
PHP Version: OS:

 

 [2016-02-04 22:14 UTC] jacob dot mroz at gmail dot com
Description:
------------
Adding spaces changes the internal representation of a SimpleXMLElement.

If you change the value of c to add a space, '\n', or an additional node <x2/> after  the node <x/>, you get the correct output.  

Test script:
---------------
<?php
var_dump(simplexml_load_string('<a><b/><c><x/></c></a>')->c);
?>



Expected result:
----------------
class SimpleXMLElement#2 (1) {
  public $x =>
  class SimpleXMLElement#3 (0) {
  }
}


Actual result:
--------------
class SimpleXMLElement#2 (1) {
  public ${0} =>
  class SimpleXMLElement#3 (1) {
    public $x =>
    class SimpleXMLElement#4 (0) {
    }
  }
}


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-07-17 18:02 UTC] cmb@php.net
-Assigned To: +Assigned To: cmb
 [2016-07-17 18:02 UTC] cmb@php.net
Appears to have been fixed in the meantime: <https://3v4l.org/t2uWt> and <https://3v4l.org/EkA3UB>.

Might be related to bug #70905.
 [2016-11-27 14:18 UTC] cmb@php.net
-Status: Assigned +Status: Duplicate
 [2016-11-27 14:18 UTC] cmb@php.net
The misbehavior had been introduced with commit 5683b6fa[1] (PHP
5.5.27 and 5.6.11), and has been fixed with commit 8ca02bb2[2]
(PHP 5.6.20).

This ticket is actually a duplicate of bug #66084.

[1] <http://git.php.net/?p=php-src.git;a=commit;h=5683b6fa> 
[2] <http://git.php.net/?p=php-src.git;a=commit;h=8ca02bb2>
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Oct 06 08:01:26 2024 UTC