From:             joh at deworks dot net
Operating system: Linux
PHP version:      Irrelevant
PHP Bug Type:     SPL related
Bug description:  ArrayIterator::seek() does not throw an Exception on invalid 
index

Description:
------------
ArrayIterator::seek() should (according to the manual:
http://www.php.net/~helly/php/ext/spl/interfaceSeekableIterator.html) 
"throw an exception if it is not possible to seek to the given position".

ArrayIterator::seek() does not. Instead, it sets the current element to
NULL (as returned by ArrayIterator::current()).

Reproduce code:
---------------
$o = new ArrayIterator(array(1,2,3));
$o->seek(3);
var_dump($o->current());

Expected result:
----------------
Fatal error: Uncaught exception 'Exception' with message 'Could not seek
to position...' ...

Actual result:
--------------
NULL

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

Reply via email to