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

From: Date: Fri, 09 Sep 2016 13:24:27 +0000
Subject: Bug #73057 [Opn->Ver]: 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-203915@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 Updated by: cmb@php.net Reported by: brian dot mcclure at adition dot com Summary: Casting a SimpleXMLElement to an array does NOT exhibit differing behavior -Status: Open +Status: Verified Type: Bug Package: SimpleXML related Operating System: Ubuntu 16.04 PHP Version: Irrelevant -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: The former behavior was sometimes buggy, and the respective change was merely a bugfix. See <https://3v4l.org/5dQ0S> for a case where the behavior was different before and after PHP 5.4. I think the documentation should be improved to emphasize the word "always". Previous Comments: ------------------------------------------------------------------------ [2016-09-09 12:50:47] brian dot mcclure at adition dot com fixed typo in summary ------------------------------------------------------------------------ [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

« previous php.bugs (#203915) next »