From: marcels at korton dot nl Operating system: Windows 2000 SP3 PHP version: 5.0.0b4 (beta4) PHP Bug Type: XML related Bug description: Count returns 1 for array with simple xml
Description: ------------ When I use the count function to get the number of elements in an array it returns 1. It does this only when I use simpleXML. In version 5.0.0b3 it worked fine. My example use a book in the xml format. Here is a small part of it <bookbody> <part> <chapter> <chapheader> <chapnum>I</chapnum> <title>The Period</title> </chapheader> </chapter> <chapter> <chapheader> <chapnum>II</chapnum> <title>The Mail</title> </chapheader> This continues for al the chapters within the book. both part and chapter are array's. We are using the windows precompiled binaries with Sambar server V6.0 build 11 november 2003 Reproduce code: --------------- $xml_mem = simplexml_load_file('2city11.xml'); for ($i = 0; $i < count($xml_mem->book->bookbody->part); $i++) { for ($j = 0; $j < count($xml_mem->book->bookbody->part[$i]->chapter); $j++) { echo $xml_mem->book->bookbody->part[$i]->chapter[$j]->chapheader->title,'<br>'; } } Expected result: ---------------- The Period The Mail The Night Shadows The Preparation The Wine-shop The Shoemaker Five Years Later A Sight A Disappointment ... Actual result: -------------- The Period -- Edit bug report at http://bugs.php.net/?id=27288&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=27288&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=27288&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=27288&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=27288&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=27288&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=27288&r=needscript Try newer version: http://bugs.php.net/fix.php?id=27288&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=27288&r=support Expected behavior: http://bugs.php.net/fix.php?id=27288&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=27288&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=27288&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=27288&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27288&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=27288&r=dst IIS Stability: http://bugs.php.net/fix.php?id=27288&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=27288&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=27288&r=float