fix: make file_get_content error check more robust

Signed-off-by: Josh <josh.t.richards@gmail.com>
jtr/checker-sig-v2
Josh 2025-12-24 22:15:22 +07:00 committed by GitHub
parent c4711b9999
commit bd640ef646
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

@ -143,7 +143,7 @@ class Checker {
// to the root .htaccess) and only hash the stable content above the marker.
if ($absoluteFilePath === $this->environmentHelper->getServerRoot() . '/.htaccess') {
$fileContent = $this->fileAccessHelper->file_get_contents($absoluteFilePath);
if ($fileContent === false) {
if (!is_string($fileContent)) {
throw new \RuntimeException('Failed to read .htaccess at ' . $absoluteFilePath);
}
@ -175,7 +175,7 @@ class Checker {
$this->mimeTypeDetector->getAllNamings()
);
$onDiskContent = $this->fileAccessHelper->file_get_contents($absoluteFilePath);
if ($onDiskContent === false) {
if (!is_string($onDiskContent)) {
throw new \RuntimeException('Failed to read mimetypelist.js at ' . $absoluteFilePath);
}