Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:33858 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 34043 invoked by uid 1010); 7 Dec 2007 22:09:57 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 34028 invoked from network); 7 Dec 2007 22:09:57 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Dec 2007 22:09:57 -0000 Authentication-Results: pb1.pair.com header.from=frank@kromann.info; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=frank@kromann.info; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain kromann.info designates 68.225.30.57 as permitted sender) X-PHP-List-Original-Sender: frank@kromann.info X-Host-Fingerprint: 68.225.30.57 wsip-68-225-30-57.oc.oc.cox.net Received: from [68.225.30.57] ([68.225.30.57:54838] helo=mail.kromann.info) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 06/9A-00432-3B4C9574 for ; Fri, 07 Dec 2007 17:09:56 -0500 Received: from warp (unknown [68.225.30.59]) by mail.kromann.info (Postfix) with SMTP id 8FE2123EC75 for ; Fri, 7 Dec 2007 14:09:52 -0800 (PST) To: X-Mailer: Swwwing 2000 Message-ID: <11970653983080000@9866357972520000.9866341568840000> MIME-Version: 1.0 Reply-To: "Frank M. Kromann" Date: Fri, 07 Dec 2007 14:09:58 -0800 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Subject: PHP 5.3 bug or changed feature?? From: frank@kromann.info ("Frank M. Kromann") Hello Everyon, Casting a SimpleXML object to an array gives different results in PHP 5.2.5 and PHP 5.3-dev. 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