#34422 [NEW]: simplexml_load_string object to array bug

From: Date: Thu, 08 Sep 2005 07:50:53 +0000
Subject: #34422 [NEW]: simplexml_load_string object to array bug
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-84687@lists.php.net to get a copy of this message
From: cyberline at techno4ever dot net Operating system: Suse 9.3 PHP version: 5.0.5 PHP Bug Type: SimpleXML related Bug description: simplexml_load_string object to array bug Description: ------------ When adding a subelement of the xml object to an array, it becomes an object again? "echo" doesn't return an object ... Reproduce code: --------------- $xml = simplexml_load_string($this->xml); foreach($xml->LISTENERS->LISTENER as $listener) { echo $listener->HOSTNAME; // Last element in tree $hosts[] = $listener->HOSTNAME; } Expected result: ---------------- 127.0.0.1 Array( [0] => 127.0.0.1 ) Actual result: -------------- 127.0.0.1 Array( [0] => SimpleXMLElement Object( [0] => 127.0.0.1 ) ) -- Edit bug report at http://bugs.php.net/?id=34422&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34422&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=34422&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=34422&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=34422&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=34422&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=34422&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=34422&r=needscript Try newer version: http://bugs.php.net/fix.php?id=34422&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=34422&r=support Expected behavior: http://bugs.php.net/fix.php?id=34422&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=34422&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=34422&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=34422&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34422&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=34422&r=dst IIS Stability: http://bugs.php.net/fix.php?id=34422&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=34422&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=34422&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=34422&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=34422&r=mysqlcfg

« previous php.bugs (#84687) next »