php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32130 ArrayIterator::seek() does not throw an Exception on invalid index
Submitted: 2005-02-27 18:12 UTC Modified: 2005-03-01 11:10 UTC
From: joh at deworks dot net Assigned: helly (profile)
Status: Closed Package: SPL related
PHP Version: 5.0.3 OS: *
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: joh at deworks dot net
New email:
PHP Version: OS:

 

 [2005-02-27 18:12 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-03-01 11:10 UTC] helly@php.net
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.


 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC