#30391 [NEW]: is_array() does not work on SimpleXMLElement

From: Date: Mon, 11 Oct 2004 07:13:23 +0000
Subject: #30391 [NEW]: is_array() does not work on SimpleXMLElement
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-67393@lists.php.net to get a copy of this message
From: sebastian@php.net Operating system: Irrelevant PHP version: 5CVS-2004-10-11 (dev) PHP Bug Type: SimpleXML related Bug description: is_array() does not work on SimpleXMLElement Description: ------------ is_array() does not work on member arrays of SimpleXMLElement objects. Reproduce code: --------------- <?php $foo = simplexml_load_string( '<?xml version="1.0" encoding="iso-8859-1" ?> <foo> <bar> <barbara>barbara</barbara> </bar> <bar> <barbara>barbara</barbara> <barbara>barbara</barbara> </bar> </foo>'); foreach ($foo->bar as $bar) { var_dump(is_array($bar->barbara)); var_dump($bar); } ?> Expected result: ---------------- bool(false) object(SimpleXMLElement)#4 (1) { ["barbara"]=> string(7) "barbara" } bool(true) object(SimpleXMLElement)#5 (1) { ["barbara"]=> array(2) { [0]=> string(7) "barbara" [1]=> string(7) "barbara" } } Actual result: -------------- bool(false) object(SimpleXMLElement)#4 (1) { ["barbara"]=> string(7) "barbara" } bool(false) object(SimpleXMLElement)#5 (1) { ["barbara"]=> array(2) { [0]=> string(7) "barbara" [1]=> string(7) "barbara" } } -- Edit bug report at http://bugs.php.net/?id=30391&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30391&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30391&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30391&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=30391&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=30391&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=30391&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=30391&r=needscript Try newer version: http://bugs.php.net/fix.php?id=30391&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=30391&r=support Expected behavior: http://bugs.php.net/fix.php?id=30391&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=30391&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=30391&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=30391&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30391&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=30391&r=dst IIS Stability: http://bugs.php.net/fix.php?id=30391&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=30391&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=30391&r=float MySQL Configuration Error: http://bugs.php.net/fix.php?id=30391&r=mysqlcfg

« previous php.bugs (#67393) next »