Skip to content

Commit

Permalink
Intercept openbasedir exceptions when detecting check for files
Browse files Browse the repository at this point in the history
  • Loading branch information
AnnoyingTechnology authored and matthiasmullie committed Mar 13, 2024
1 parent 7f64dad commit 0127dd0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Minify.php
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,13 @@ protected function canImportFile($path)
return false;
}

return strlen($path) < PHP_MAXPATHLEN && @is_file($path) && is_readable($path);
try {
return strlen($path) < PHP_MAXPATHLEN && @is_file($path) && is_readable($path);
}
// catch openbasedir exceptions which are not caught by @ on is_file()
catch(\Exception $e) {
return false;
}
}

/**
Expand Down

0 comments on commit 0127dd0

Please sign in to comment.