Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:33882 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 83023 invoked by uid 1010); 9 Dec 2007 12:24:17 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 83008 invoked from network); 9 Dec 2007 12:24:17 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 Dec 2007 12:24:17 -0000 Authentication-Results: pb1.pair.com header.from=rrichards@ctindustries.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=rrichards@ctindustries.net; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain ctindustries.net from 216.117.147.250 cause and error) X-PHP-List-Original-Sender: rrichards@ctindustries.net X-Host-Fingerprint: 216.117.147.250 unknown Received: from [216.117.147.250] ([216.117.147.250:35088] helo=ctindustries.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id ED/14-51375-07EDB574 for ; Sun, 09 Dec 2007 07:24:16 -0500 Received: from [127.0.0.1] ([67.158.171.203]) (authenticated bits=0) by ctindustries.net (8.13.8/8.13.8) with ESMTP id lB9CDuL6009617; Sun, 9 Dec 2007 07:13:57 -0500 Message-ID: <475BDDF1.7040605@ctindustries.net> Date: Sun, 09 Dec 2007 07:22:09 -0500 User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 To: "Frank M. Kromann" CC: internals@lists.php.net, helly@php.net References: <11970653983080000@9866357972520000.9866341568840000> In-Reply-To: <11970653983080000@9866357972520000.9866341568840000> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Antivirus: avast! (VPS 071208-0, 12/08/2007), Outbound message X-Antivirus-Status: Clean X-Virus-Scanned: ClamAV 0.91.2/5055/Sun Dec 9 04:50:01 2007 on ctindustries.net X-Virus-Status: Clean X-Spam-Status: No, score=0.0 required=4.4 tests=AWL autolearn=disabled version=3.1.9 X-Spam-Checker-Version: SpamAssassin 3.1.9 (2007-02-13) on ctindustries.net Subject: Re: [PHP-DEV] PHP 5.3 bug or changed feature?? From: rrichards@ctindustries.net (Rob Richards) Hi Frank, Frank M. Kromann wrote: > Hello Everyon, > > Casting a SimpleXML object to an array gives different results in PHP > 5.2.5 and PHP 5.3-dev. > This is due to the implementation of the get_debug_info handler merged from HEAD. The same result happens when calling get_object_vars on a SimpleXMLElement object. Marcus, was it intended to only include @attributes with print_r/var_dump? Rob > Source: > > $xml = simplexml_load_file("sample.xml"); > > foreach($xml->column as $column) { > var_dump($column); > var_dump((array)$column); > } > > sample.xml > > ?xml version="1.0"?> > > > cv > entsimp > > > pp > sc > > > > PHP 5.2 output: > object(SimpleXMLElement)#4 (2) { > ["@attributes"]=> > array(1) { > ["name"]=> > string(13) "ENTERTAINMENT" > } > ["module"]=> > array(2) { > [0]=> > string(2) "cv" > [1]=> > string(7) "entsimp" > } > } > array(2) { > ["@attributes"]=> > array(1) { > ["name"]=> > string(13) "ENTERTAINMENT" > } > ["module"]=> > array(2) { > [0]=> > string(2) "cv" > [1]=> > string(7) "entsimp" > } > } > object(SimpleXMLElement)#5 (2) { > ["@attributes"]=> > array(1) { > ["name"]=> > string(12) "SEAT CONTROL" > } > ["module"]=> > array(2) { > [0]=> > string(2) "pp" > [1]=> > string(2) "sc" > } > } > array(2) { > ["@attributes"]=> > array(1) { > ["name"]=> > string(12) "SEAT CONTROL" > } > ["module"]=> > array(2) { > [0]=> > string(2) "pp" > [1]=> > string(2) "sc" > } > } > > PHP 5.3 output: > > object(SimpleXMLElement)#4 (2) { > ["@attributes"]=> > array(1) { > ["name"]=> > string(13) "ENTERTAINMENT" > } > ["module"]=> > array(2) { > [0]=> > string(2) "cv" > [1]=> > string(7) "entsimp" > } > } > array(1) { > ["module"]=> > array(2) { > [0]=> > string(2) "cv" > [1]=> > string(7) "entsimp" > } > } > object(SimpleXMLElement)#5 (2) { > ["@attributes"]=> > array(1) { > ["name"]=> > string(12) "SEAT CONTROL" > } > ["module"]=> > array(2) { > [0]=> > string(2) "pp" > [1]=> > string(2) "sc" > } > } > array(1) { > ["module"]=> > array(2) { > [0]=> > string(2) "pp" > [1]=> > string(2) "sc" > } > } > > Not that the attributes are gone when SimpleXML objects are converted in > PHP 5.3. Is this a bug or a feature change? > > - Frank > >