#37598 [Opn->Bgs]: prev() fonction crash the array pointer
ID: 37598
Updated by: pajoye@php.net
Reported By: jerebenz at gmail dot com
-Status: Open
+Status: Bogus
Bug Type: Scripting Engine problem
Operating System: Unix
PHP Version: 4.4.2
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
You should check the return value of prev and next. The state is
undefined as out of range. Reset the array after having reached the end
or beginning.
Previous Comments:
------------------------------------------------------------------------
[2006-05-26 02:08:33] jerebenz at gmail dot com
Hi,
The problem occur when the pointer of an array is at the start and I do
a
prev().
If I try to do current() after that, I see nothing, and if I try
next()
and current() again, still nothing.
Bye
------------------------------------------------------------------------
[2006-05-26 01:58:40] jerebenz at gmail dot com
Description:
------------
Hi,
The problem occur the pointer of an array is at the start and I do a
prev().
If I try to do current() after that, I see nothing, and if I try next()
and current() again, still nothing.
Bye
Reproduce code:
---------------
<?php
$tab = array('4', '6');
echo current($tab);
prev($tab);
echo current($tab);
next($tab);
echo current($tab);
?>
Expected result:
----------------
446
Actual result:
--------------
4
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=37598&edit=1
Thread (3 messages)