Skip to content

Commit 2a677c4

Browse files
committed
RobotLoader: getRealPath() can return false (in PHAR)
1 parent 4dbf827 commit 2a677c4

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

258258
$iterator = Nette\Utils\Finder::findFiles($acceptFiles)
259259
->filter(function (SplFileInfo $file) use (&$disallow) {
260-
return !isset($disallow[str_replace('\\', '/', $file->getRealPath())]);
260+
return $file->getRealPath() === false
261+
? true
262+
: !isset($disallow[str_replace('\\', '/', $file->getRealPath())]);
261263
})
262264
->from($dir)
263265
->exclude($ignoreDirs)
264266
->filter($filter = function (SplFileInfo $dir) use (&$disallow) {
267+
if ($dir->getRealPath() === false) {
268+
return true;
269+
}
265270
$path = str_replace('\\', '/', $dir->getRealPath());
266271
if (is_file("$path/netterobots.txt")) {
267272
foreach (file("$path/netterobots.txt") as $s) {

0 commit comments

Comments
 (0)