Rewind RecursiveIteratorIterator before use

Fixes #268 and #288.

More info: https://bugs.php.net/bug.php?id=62914

>As a reminder, all iterators have been designed in a way that you need to call rewind before using.
This commit is contained in:
Louis Matthijssen 2014-06-15 16:27:15 +02:00
parent e8688573ab
commit be00834d80
1 changed files with 1 additions and 0 deletions

View File

@ -385,6 +385,7 @@ class CmsObject implements ArrayAccess
$it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dirPath));
$it->setMaxDepth(1); // Support only a single level of subdirectories
$it->rewind();
while($it->valid()) {
if ($it->isFile() && in_array($it->getExtension(), static::$allowedExtensions)) {