From 73b28773128533c641fa7711aae7d6e85fdb8045 Mon Sep 17 00:00:00 2001 From: Inhere Date: Wed, 13 Apr 2022 19:13:28 +0800 Subject: [PATCH] fix: fix file finder error on iter sub-dir --- src/FileFinder.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/FileFinder.php b/src/FileFinder.php index a3c6d8f..2bcd1c9 100644 --- a/src/FileFinder.php +++ b/src/FileFinder.php @@ -682,7 +682,7 @@ private function findInDirectory(string $dir): Iterator private string $directorySep = '/'; private bool $skipUnreadableDirs; - public function __construct(string $path, int $flags, bool $recursive, bool $skipUnreadableDirs = true) + public function __construct(string $path, int $flags, bool $recursive = true, bool $skipUnreadableDirs = true) { if ($flags & (self::CURRENT_AS_PATHNAME | self::CURRENT_AS_SELF)) { throw new RuntimeException('This iterator only support returning current as fileInfo.'); @@ -733,6 +733,7 @@ public function getChildren(): RecursiveDirectoryIterator { try { $children = parent::getChildren(); + if ($children instanceof self) { $children->rootPath = $this->rootPath; $children->rewindable = &$this->rewindable;