From 6f9cea738178dbb1b5fba6387a715b0da1a4e0d4 Mon Sep 17 00:00:00 2001 From: David Grudl Date: Tue, 15 Sep 2020 17:10:59 +0200 Subject: [PATCH] RobotLoader: getRealPath() can return false (in PHAR) --- src/RobotLoader/RobotLoader.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/RobotLoader/RobotLoader.php b/src/RobotLoader/RobotLoader.php index 772b5d5..a0f93b7 100644 --- a/src/RobotLoader/RobotLoader.php +++ b/src/RobotLoader/RobotLoader.php @@ -253,11 +253,16 @@ private function createFileIterator($dir) $acceptFiles = is_array($this->acceptFiles) ? $this->acceptFiles : preg_split('#[,\s]+#', $this->acceptFiles); $iterator = Nette\Utils\Finder::findFiles($acceptFiles) ->filter(function (SplFileInfo $file) use (&$disallow) { - return !isset($disallow[str_replace('\\', '/', $file->getRealPath())]); + return $file->getRealPath() === false + ? true + : !isset($disallow[str_replace('\\', '/', $file->getRealPath())]); }) ->from($dir) ->exclude($ignoreDirs) ->filter($filter = function (SplFileInfo $dir) use (&$disallow) { + if ($dir->getRealPath() === false) { + return true; + } $path = str_replace('\\', '/', $dir->getRealPath()); if (is_file("$path/netterobots.txt")) { foreach (file("$path/netterobots.txt") as $s) {