It seems like $nzbpath can also be of type false; however, parameter $filename of file_exists() does only seem to accept string, maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the ignore-type annotation
26
if (! file_exists(/** @scrutinizer ignore-type */ $nzbpath)) {
Loading history...
27
return response()->json(['error' => 'NZB file not found'], 404);
It seems like you do not handle an error condition for readgzfile(). This can introduce security issues, and is generally not recommended.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the ignore-unhandled annotation
If you suppress an error, we recommend checking for the error condition explicitly:
// For example instead of@mkdir($dir);// Better useif(@mkdir($dir)===false){thrownew\RuntimeException('The directory '.$dir.' could not be created.');}
It seems like $nzbpath can also be of type false; however, parameter $filename of readgzfile() does only seem to accept string, maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the ignore-type annotation