Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions Neos.Flow/Classes/Core/Booting/Scripts.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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(
Expand Down Expand Up @@ -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);
Expand Down