Bug #68557 [NEW]: RecursiveDirectoryIterator::seek(0) broken after calling getChildren()
From: bschussek at gmail dot com
Operating system: Ubuntu 14.04
PHP version: 5.5.19
Package: SPL related
Bug Type: Bug
Bug description:RecursiveDirectoryIterator::seek(0) broken after calling getChildren()
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 bug report at https://bugs.php.net/bug.php?id=68557&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=68557&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=68557&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=68557&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=68557&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=68557&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=68557&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=68557&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=68557&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=68557&r=support
Expected behavior: https://bugs.php.net/fix.php?id=68557&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=68557&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=68557&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=68557&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=68557&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=68557&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=68557&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=68557&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=68557&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=68557&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=68557&r=mysqlcfg
Thread (7 messages)
- bschussek at gmail dot com