Skip to content

Commit 6f9cea7

Browse files
committed
RobotLoader: getRealPath() can return false (in PHAR)
1 parent bfb0ac5 commit 6f9cea7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/RobotLoader/RobotLoader.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,11 +253,16 @@ private function createFileIterator($dir)
253253
$acceptFiles = is_array($this->acceptFiles) ? $this->acceptFiles : preg_split('#[,\s]+#', $this->acceptFiles);
254254
$iterator = Nette\Utils\Finder::findFiles($acceptFiles)
255255
->filter(function (SplFileInfo $file) use (&$disallow) {
256-
return !isset($disallow[str_replace('\\', '/', $file->getRealPath())]);
256+
return $file->getRealPath() === false
257+
? true
258+
: !isset($disallow[str_replace('\\', '/', $file->getRealPath())]);
257259
})
258260
->from($dir)
259261
->exclude($ignoreDirs)
260262
->filter($filter = function (SplFileInfo $dir) use (&$disallow) {
263+
if ($dir->getRealPath() === false) {
264+
return true;
265+
}
261266
$path = str_replace('\\', '/', $dir->getRealPath());
262267
if (is_file("$path/netterobots.txt")) {
263268
foreach (file("$path/netterobots.txt") as $s) {

0 commit comments

Comments
 (0)