diff --git a/src/SDK/Resource/Detectors/Host.php b/src/SDK/Resource/Detectors/Host.php index 7d74f6991..3a353cc67 100644 --- a/src/SDK/Resource/Detectors/Host.php +++ b/src/SDK/Resource/Detectors/Host.php @@ -54,7 +54,9 @@ private function getLinuxId(): ?string foreach ($paths as $path) { $file = $this->dir . $path; if (is_file($file) && is_readable($file)) { - return trim(file_get_contents($file)); + $contents = file_get_contents($file); + + return $contents !== false ? trim($contents) : null; } } @@ -65,7 +67,9 @@ private function getBsdId(): ?string { $file = $this->dir . self::PATH_ETC_HOSTID; if (is_file($file) && is_readable($file)) { - return trim(file_get_contents($file)); + $contents = file_get_contents($file); + + return $contents !== false ? trim($contents) : null; } $out = exec('which kenv && kenv -q smbios.system.uuid');