#31123 [NEW]: Change of return values

From: Date: Thu, 16 Dec 2004 13:35:29 +0000
Subject: #31123 [NEW]: Change of return values
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-70355@lists.php.net to get a copy of this message
From: bate@php.net Operating system: FreeBSD PHP version: 4.3.10 PHP Bug Type: *General Issues Bug description: Change of return values Description: ------------ foreach mechanism changed. foreach returns now the array not the key. This changed from 4.3.9 to 4.3.10 5.0.x retuns too as $key the sub arrays Reproduce code: --------------- <pre> <?php $demo_array = array('one', 'two', 'three'); print_r(array_keys($demo_array)); echo "\n\n"; foreach(array_keys($demo_array) as $key) { echo $key."<br>"; } ?> Expected result: ---------------- Array ( [0] => 0 [1] => 1 [2] => 2 ) 0 1 2 Actual result: -------------- Array ( [0] => 0 [1] => 1 [2] => 2 ) Array Array Array -- Edit bug report at http://bugs.php.net/?id=31123&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=31123&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=31123&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=31123&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=31123&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=31123&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=31123&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=31123&r=needscript Try newer version: http://bugs.php.net/fix.php?id=31123&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=31123&r=support Expected behavior: http://bugs.php.net/fix.php?id=31123&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=31123&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=31123&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=31123&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=31123&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=31123&r=dst IIS Stability: http://bugs.php.net/fix.php?id=31123&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=31123&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=31123&r=float MySQL Configuration Error: http://bugs.php.net/fix.php?id=31123&r=mysqlcfg

« previous php.bugs (#70355) next »