Skip to content

Commit 15c1ecd

Browse files
committed
RobotLoader: getRealPath() can return false (in PHAR)
1 parent 2fbcd6b commit 15c1ecd

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
@@ -262,11 +262,16 @@ private function createFileIterator(string $dir): Nette\Utils\Finder
262262

263263
$iterator = Nette\Utils\Finder::findFiles($acceptFiles)
264264
->filter(function (SplFileInfo $file) use (&$disallow) {
265-
return !isset($disallow[str_replace('\\', '/', $file->getRealPath())]);
265+
return $file->getRealPath() === false
266+
? true
267+
: !isset($disallow[str_replace('\\', '/', $file->getRealPath())]);
266268
})
267269
->from($dir)
268270
->exclude($ignoreDirs)
269271
->filter($filter = function (SplFileInfo $dir) use (&$disallow) {
272+
if ($dir->getRealPath() === false) {
273+
return true;
274+
}
270275
$path = str_replace('\\', '/', $dir->getRealPath());
271276
if (is_file("$path/netterobots.txt")) {
272277
foreach (file("$path/netterobots.txt") as $s) {

0 commit comments

Comments
 (0)