#32130 [Asn->Csd]: ArrayIterator::seek() does not throw an Exception on invalid index

From: Date: Tue, 01 Mar 2005 10:10:14 +0000
Subject: #32130 [Asn->Csd]: ArrayIterator::seek() does not throw an Exception on invalid index
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-74739@lists.php.net to get a copy of this message
ID: 32130 Updated by: helly@php.net Reported By: joh at deworks dot net -Status: Assigned +Status: Closed Bug Type: SPL related Operating System: * -PHP Version: 5CVS-2005-02-14 +PHP Version: 5.0.3 Assigned To: helly New Comment: This bug has been fixed in CVS. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2005-02-27 18:12:58] joh at deworks dot net 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 this bug report at http://bugs.php.net/?id=32130&edit=1

« previous php.bugs (#74739) next »