From:             d dot peters at gmail dot com
Operating system: Linux
PHP version:      5.0.1
PHP Bug Type:     Zend Engine 2 problem
Bug description:  SPL: ArrayIterator: seek($postion) does not work

Description:
------------
http://www.php.net/~helly/php/ext/spl/classArrayIterator.html#a8

ArrayIterator::seek($position) always jumps to the 2nd element, no matter
which value $position had...

I saw this in changelog:
Fixed bug #27042 (SPL: SeekableIterator seek() broken). (Marcus)

But it was fixed in 5.0.0 Beta4 and I use 5.0.1... 

Reproduce code:
---------------
$a = array(0,1,2,3,4,5,6,7,8,9);
$it = new ArrayIterator($a);
$it->rewind();

for ($i=0; $i < $it->count(); $i++)
{
  $it->seek($i);
  echo $it->current();
}

// output: 0111111111
// -> seek always jumps to the 1st position...


Expected result:
----------------
output: 0123456789

In my opinion it only makes sense to "seek" to the specified position...
but correct my if i'm wrong ;-)

Actual result:
--------------
output: 0111111111

-- 
Edit bug report at http://bugs.php.net/?id=30278&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=30278&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30278&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30278&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=30278&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=30278&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=30278&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=30278&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=30278&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=30278&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=30278&r=notwrong
Not enough info:             http://bugs.php.net/fix.php?id=30278&r=notenoughinfo
Submitted twice:             http://bugs.php.net/fix.php?id=30278&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=30278&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=30278&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=30278&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=30278&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=30278&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=30278&r=float
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=30278&r=mysqlcfg

Reply via email to