#48816 [Opn->Asn]: IteratorIterator seek() causes bus error
| From: | pajoye@php.net | Date: | Mon, 06 Jul 2009 16:21:25 +0000 |
| Subject: | #48816 [Opn->Asn]: IteratorIterator seek() causes bus error | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-139337@lists.php.net to get a copy of this message | ||
ID: 48816
Updated by: pajoye@php.net
Reported By: kim at burgestrand dot se
-Status: Open
+Status: Assigned
Bug Type: SPL related
Operating System: Mac OS 10.5.7
PHP Version: 5.3.0
-Assigned To:
+Assigned To: colder
Previous Comments:
------------------------------------------------------------------------
[2009-07-06 15:56:27] kim at burgestrand dot se
I compiled PHP 5.2.10 (configure command: './configure'
'--with-mysql=/usr/local/mysql'
'--with-mysqli=/usr/local/mysql/bin/mysql_config' '--enable-mbstring'
'--with-curl=/usr' '--enable-sockets'
'--with-libxml-dir=/opt/local/include/libxml2/libxml'
'--with-pdo-mysql=shared,/usr/local/mysql'
'--with-iconv=shared,/opt/local' '--with-apxs2'
'--with-config-file-path=/etc/php'
'--with-config-file-scan-dir=/etc/php/conf.d') and tested the code.
No out of bounds exceptions, and the output was consistent:
int(0)
int(1)
------------------------------------------------------------------------
[2009-07-06 15:51:24] kim at burgestrand dot se
I had the same issue on Debian using PHP 5.2.6-3 with Suhosin-Patch
0.9.6.2
sometimes. I mean, have a peek at this output:
http://pastebin.com/f1dd1bc27 (linked to pastebin
because the bug system
thinks I'm spamming)
Same code as submitted, with a shebang added to the top #!/usr/bin/env
php.
------------------------------------------------------------------------
[2009-07-06 13:46:34] pajoye@php.net
I can't reproduce here, I got a out of bounds exception on the seek
call.
------------------------------------------------------------------------
[2009-07-06 13:32:52] kim at burgestrand dot se
Description:
------------
After using seek() on an IteratorIterator containing an ArrayIterator
the next() call results in a bus error.
Also, the seek() method doesnt seem to advance the key to the
specified position on the inner iterator (unless issuing
getInnerIterator()->seek(x) directly and calling
getInnerIterator()->current()).
Reproduce code:
---------------
<?php
$iiter = new IteratorIterator(new ArrayIterator(range(0, 5)));
$iiter->rewind();
$iiter->seek(2);
var_dump($iiter->current());
$iiter->next(); // bus error
var_dump($iiter->current());
/* End of file */
Expected result:
----------------
int(2)
int(3)
Actual result:
--------------
int(0)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=48816&edit=1