From fa6a52f697118058f35e4b28175ca0322f7af8ea Mon Sep 17 00:00:00 2001 From: Thorsten Reiter Date: Wed, 11 Dec 2024 14:15:17 +0100 Subject: [PATCH] add is_file check --- src/bundle/Core/Command/ReindexCommand.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bundle/Core/Command/ReindexCommand.php b/src/bundle/Core/Command/ReindexCommand.php index cc80d668bf..936425d21f 100644 --- a/src/bundle/Core/Command/ReindexCommand.php +++ b/src/bundle/Core/Command/ReindexCommand.php @@ -450,7 +450,7 @@ private function getPhpPath() private function getNumberOfCPUCores() { $cores = 1; - if (isset($_SERVER['PLATFORM_BRANCH']) && is_readable('/run/config.json')) { + if (isset($_SERVER['PLATFORM_BRANCH']) && is_readable('/run/config.json') && is_file('/run/config.json')) { // Ibexa Cloud: read #cpus from config $configJsonEncoded = file_get_contents('/run/config.json'); if ($configJsonEncoded === false) { @@ -458,7 +458,7 @@ private function getNumberOfCPUCores() } $configJson = json_decode($configJsonEncoded); $cores = isset($configJson->info->limits->cpu) ? max(1, (int) ($configJson->info->limits->cpu)) : 1; - } elseif (is_readable('/proc/cpuinfo')) { + } elseif (is_readable('/proc/cpuinfo') && is_file('/proc/cpuinfo')) { // Linux (and potentially Windows with linux sub systems) $cpuinfo = file_get_contents('/proc/cpuinfo'); preg_match_all('/^processor/m', $cpuinfo, $matches);