diff --git a/Neos.Flow/Classes/Core/Booting/Scripts.php b/Neos.Flow/Classes/Core/Booting/Scripts.php index d8eb41b6cd..9e42e3f40d 100644 --- a/Neos.Flow/Classes/Core/Booting/Scripts.php +++ b/Neos.Flow/Classes/Core/Booting/Scripts.php @@ -874,9 +874,9 @@ protected static function ensureCLISubrequestsUseCurrentlyRunningPhpBinary($phpB $output = []; exec(join(' ', $command), $output, $result); - if ($result === 0 && count($output) === 1) { + if ($result === 0 && $output !== []) { // Resolve any wrapper - $configuredPhpBinaryPathAndFilename = $output[0]; + $configuredPhpBinaryPathAndFilename = end($output); // Last entry, skip possible emitted deprecations } else { // Resolve any symlinks that the configured php might be pointing to $configuredPhpBinaryPathAndFilename = realpath($phpBinaryPathAndFilename); @@ -896,7 +896,7 @@ protected static function ensureCLISubrequestsUseCurrentlyRunningPhpBinary($phpB // bypass with exec open_basedir restriction $output = []; exec(PHP_BINARY . ' -r "echo realpath(PHP_BINARY);"', $output); - $realPhpBinary = $output[0]; + $realPhpBinary = end($output); // Last entry, skip possible emitted deprecations } if (strcmp($realPhpBinary, $configuredPhpBinaryPathAndFilename) !== 0) { throw new Exception\SubProcessException(sprintf( @@ -944,7 +944,8 @@ protected static function ensureWebSubrequestsUseCurrentlyRunningPhpVersion($php exec(join(' ', $command), $output, $result); - $phpInformation = json_decode($output[0] ?? '{}', true) ?: []; + $resultWithJson = end($output); // For multiple lines use the last line, to skip possible emitted deprecations + $phpInformation = $resultWithJson ? json_decode($resultWithJson, true) : false; if ($result !== 0 || ($phpInformation['sapi'] ?? null) !== 'cli') { throw new Exception\SubProcessException(sprintf('PHP binary might not exist or is not suitable for cli usage. Command `%s` didnt succeed.', $phpCommand), 1689676967447);