Bug #68557 [Csd->Fbk]: RecursiveDirectoryIterator::seek(0) broken after calling getChildren()
Edit report at https://bugs.php.net/bug.php?id=68557&edit=1
ID: 68557
Updated by: jpauli@php.net
Reported by: bschussek at gmail dot com
Summary: RecursiveDirectoryIterator::seek(0) broken after
calling getChildren()
-Status: Closed
+Status: Feedback
Type: Bug
Package: SPL related
Operating System: Ubuntu 14.04
PHP Version: 5.5.19
Block user comment: N
Private report: N
New Comment:
Please try using this snapshot:
http://snaps.php.net/php5.5-latest.tar.gz
For Windows:
http://windows.php.net/snapshots/
Previous Comments:
------------------------------------------------------------------------
[2015-02-20 14:46:10] jpauli@php.net
Automatic comment on behalf of jpauli
Revision: http://git.php.net/?p=php-src.git;a=commit;h=c111d1cd701d2720fdf2707640e70cc9ec5cf76e
Log: fix #68557
------------------------------------------------------------------------
[2015-02-20 14:45:47] jpauli@php.net
Automatic comment on behalf of jpauli
Revision: http://git.php.net/?p=php-src.git;a=commit;h=c111d1cd701d2720fdf2707640e70cc9ec5cf76e
Log: fix #68557
------------------------------------------------------------------------
[2015-02-20 14:45:26] jpauli@php.net
Automatic comment on behalf of jpauli
Revision: http://git.php.net/?p=php-src.git;a=commit;h=c111d1cd701d2720fdf2707640e70cc9ec5cf76e
Log: fix #68557
------------------------------------------------------------------------
[2014-12-06 20:06:53] bschussek at gmail dot com
I did some more testing. The same bugs appears for DirectoryIterator:
---------------
<?php
mkdir(__DIR__.'/temp');
mkdir(__DIR__.'/temp/a');
mkdir(__DIR__.'/temp/b');
$iterator = new DirectoryIterator(__DIR__.'/temp');
$iterator->seek(0);
var_dump($iterator->current()->getPathname());
$iterator->seek(1);
var_dump($iterator->current()->getPathname());
$iterator->seek(0);
var_dump($iterator->current()->getPathname());
$iterator->seek(1);
var_dump($iterator->current()->getPathname());
rmdir(__DIR__.'/temp/a');
rmdir(__DIR__.'/temp/b');
rmdir(__DIR__.'/temp');
---------------
Neither rewind() nor seek(0) works.
------------------------------------------------------------------------
[2014-12-06 19:15:31] bschussek at gmail dot com
Description:
------------
After calling RecursiveDirectoryIterator::getChildren(), RecursiveDirectoryIterator::seek(0) has no
effect.
Test script:
---------------
<?php
mkdir(__DIR__.'/temp');
mkdir(__DIR__.'/temp/a');
mkdir(__DIR__.'/temp/b');
$iterator = new \RecursiveDirectoryIterator(__DIR__.'/temp',
\RecursiveDirectoryIterator::SKIP_DOTS);
$iterator->seek(0);
var_dump($iterator->key());
$iterator->seek(1);
var_dump($iterator->key());
$iterator->getChildren();
$iterator->seek(0);
var_dump($iterator->key());
$iterator->seek(1);
var_dump($iterator->key());
rmdir(__DIR__.'/temp/a');
rmdir(__DIR__.'/temp/b');
rmdir(__DIR__.'/temp');
Expected result:
----------------
string(7) "<snip>/temp/b"
string(7) "<snip>/temp/a"
string(7) "<snip>/temp/b"
string(7) "<snip>/temp/a"
Actual result:
--------------
string(7) "<snip>/temp/b"
string(7) "<snip>/temp/a"
string(7) "<snip>/temp/a"
string(7) "<snip>/temp/a"
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=68557&edit=1
Thread (7 messages)