From:             prometheus__0 at hotmail dot com
Operating system: Linux Sles10
PHP version:      5.2.1RC2
PHP Bug Type:     Scripting Engine problem
Bug description:  Wrong behaviour of next() and prev()

Description:
------------
the bug report with id 27782 is the same as this one
http://bugs.php.net/bug.php?id=27782

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.

i tested it with older php5 versions and it seems this bug occures within
all php5 versions

bug http://bugs.php.net/bug.php?id=37598 occures too

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=40028&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=40028&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=40028&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=40028&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=40028&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=40028&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=40028&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=40028&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=40028&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=40028&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=40028&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=40028&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=40028&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=40028&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=40028&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=40028&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=40028&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=40028&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=40028&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=40028&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=40028&r=mysqlcfg

Reply via email to