Bug #73057 [Opn]: Casting a SimpleXMLElement to an array does NOT exhibit differing behavior

From: Date: Fri, 09 Sep 2016 12:50:48 +0000
Subject: Bug #73057 [Opn]: Casting a SimpleXMLElement to an array does NOT exhibit differing behavior
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-203912@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73057&edit=1

 ID:                 73057
 User updated by:    brian dot mcclure at adition dot com
 Reported by:        brian dot mcclure at adition dot com
-Summary:            Casting a SimpleXMLElement to an array does exhibit
                     differing behavior
+Summary:            Casting a SimpleXMLElement to an array does NOT
                     exhibit differing behavior
 Status:             Open
 Type:               Bug
 Package:            SimpleXML related
 Operating System:   Ubuntu 16.04
 PHP Version:        Irrelevant
 Block user comment: N
 Private report:     N

 New Comment:

fixed typo in summary


Previous Comments:
------------------------------------------------------------------------
[2016-09-09 12:38:29] brian dot mcclure at adition dot com

Description:
------------
According to 5.4 changenotes, http://php.net/manual/en/migration54.other.php

there is some sort of behavior change to be expected when casting a SimnpleXMLElement to an array.
But unless I'm misunderstanding what the docs mean, the bahavior is consistent all the way from
5.1 to 7.1

https://3v4l.org/F4DfI

If this is not a bug, would someone mind providing an example of the before and after behavior?

Test script:
---------------
<?php 
$xml =
"<xml><first-node>foo</first-node><second-node><nested-node>bar</nested-node></second-node><third-node>baz</third-node></xml>";

$a = new SimpleXMLElement($xml);

var_export((array)$a);



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=73057&edit=1


Thread (3 messages)

« previous php.bugs (#203912) next »