From: giovanni at giacobbi dot net Operating system: Linux PHP version: 4.3.4 PHP Bug Type: Scripting Engine problem Bug description: Wrong behaviour of next() and prev()
Description: ------------ As stated in documentation, next() returns the NEXT element in the array and THEN increases internal pointer. Thus, when this function returns FALSE, I expect the internal pointer to be in the last position, thus prev() should return end()-1 element. Reproduce code: --------------- <?php $a = array("a", "b", "c"); reset($a); while (next($a) !== FALSE); var_dump(prev($a)); Expected result: ---------------- string(1) "b" Actual result: -------------- bool(false) -- Edit bug report at http://bugs.php.net/?id=27782&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=27782&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=27782&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=27782&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=27782&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=27782&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=27782&r=needscript Try newer version: http://bugs.php.net/fix.php?id=27782&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=27782&r=support Expected behavior: http://bugs.php.net/fix.php?id=27782&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=27782&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=27782&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=27782&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27782&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=27782&r=dst IIS Stability: http://bugs.php.net/fix.php?id=27782&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=27782&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=27782&r=float