diff --git a/src/Symfony/Component/Config/Resource/GlobResource.php b/src/Symfony/Component/Config/Resource/GlobResource.php index fc4f5ec3b6e1a..fb490660b2832 100644 --- a/src/Symfony/Component/Config/Resource/GlobResource.php +++ b/src/Symfony/Component/Config/Resource/GlobResource.php @@ -97,7 +97,7 @@ public function __wakeup(): void public function getIterator(): \Traversable { - if (!file_exists($this->prefix) || (!$this->recursive && '' === $this->pattern)) { + if ((!$this->recursive && '' === $this->pattern) || !file_exists($this->prefix)) { return; } @@ -148,7 +148,7 @@ public function getIterator(): \Traversable } while ($prefix !== $dirPath && $dirPath !== $normalizedPath = \dirname($dirPath)); } - if (is_file($path) && (null === $regex || preg_match($regex, substr(str_replace('\\', '/', $path), $prefixLen)))) { + if ((null === $regex || preg_match($regex, substr(str_replace('\\', '/', $path), $prefixLen))) && is_file($path)) { yield $path => new \SplFileInfo($path); } if (!is_dir($path)) { @@ -165,7 +165,7 @@ public function getIterator(): \Traversable new \RecursiveCallbackFilterIterator( new \RecursiveDirectoryIterator($path, \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS), fn (\SplFileInfo $file, $path) => !isset($this->excludedPrefixes[$path = str_replace('\\', '/', $path)]) - && (null === $regex || $file->isDir() || preg_match($regex, substr($path, $prefixLen))) + && (null === $regex || preg_match($regex, substr($path, $prefixLen)) || $file->isDir()) && '.' !== $file->getBasename()[0] ), \RecursiveIteratorIterator::LEAVES_ONLY