Bug #53119 [Opn->Asn]: LimitIterator(ArrayIterator)->seek() doesn't work correctly after OutOfBoundsE

From: Date: Wed, 16 Nov 2011 14:19:07 +0000
Subject: Bug #53119 [Opn->Asn]: LimitIterator(ArrayIterator)->seek() doesn't work correctly after OutOfBoundsE
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-165246@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=53119&edit=1 ID: 53119 Updated by: felipe@php.net Reported by: marc-bennewitz at arcor dot de Summary: LimitIterator(ArrayIterator)->seek() doesn't work correctly after OutOfBoundsE -Status: Open +Status: Assigned Type: Bug Package: SPL related Operating System: Linux PHP Version: 5.3.3 -Assigned To: +Assigned To: colder Block user comment: N Private report: N Previous Comments: ------------------------------------------------------------------------ [2010-10-21 18:22:10] marc-bennewitz at arcor dot de The LimitIterator should have the same behavior as the inner iterator (in this example ArrayIterator) but on ArrayIterator there is no need to call rewind after an Exception. ------------------------------------------------------------------------ [2010-10-21 11:50:29] johannes@php.net The exception leaves the iterator in undefined behavior. That is expected. ------------------------------------------------------------------------ [2010-10-20 20:47:02] marc-bennewitz at arcor dot de Description: ------------ Seeking after an OutOfBoundException doesn't work without call of rewind. With php < 5.3 it works as expected. Test script: --------------- $it = new ArrayIterator(array('zf9396', 'foo', null)); $it->rewind(); try { $it->seek(3); } catch (OutOfBoundsException $e) { var_dump($it->key()); $it->seek(0); var_dump($it->key()); } $lit = new LimitIterator($it, 0, 10); try { $lit->seek(3); } catch (OutOfBoundsException $e) { var_dump($lit->key()); $lit->seek(0); var_dump($lit->key()); } Expected result: ---------------- NULL int(0) NULL int(0) Actual result: -------------- NULL int(0) NULL NULL ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=53119&edit=1

« previous php.bugs (#165246) next »