Skip to content

Commit

Permalink
RobotLoader: getRealPath() can return false (in PHAR)
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Nov 6, 2020
1 parent bfb0ac5 commit 6f9cea7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/RobotLoader/RobotLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 6f9cea7

Please sign in to comment.