Fix #81520 TEST_PHP_CGI_EXECUTABLE badly set in run-tests.php

This commit is contained in:
Remi Collet 2021-10-12 13:33:16 +02:00
parent ebaed43473
commit 3fb1cf24c3
No known key found for this signature in database
GPG key ID: DC9FF8D3EE5AF27F

View file

@ -1057,11 +1057,14 @@ function get_binary(string $php, string $sapi, string $sapi_path): ?string
if (IS_WINDOWS && file_exists("$dir/$sapi.exe")) { if (IS_WINDOWS && file_exists("$dir/$sapi.exe")) {
return realpath("$dir/$sapi.exe"); return realpath("$dir/$sapi.exe");
} }
// Sources tree
if (file_exists("$dir/../../$sapi_path")) { if (file_exists("$dir/../../$sapi_path")) {
return realpath("$dir/../../$sapi_path"); return realpath("$dir/../../$sapi_path");
} }
if (file_exists("$dir/$sapi")) { // Installation tre, preserve command prefix/suffix
return realpath("$dir/$sapi"); $inst = str_replace('php', $sapi, basename($php));
if (file_exists("$dir/$inst")) {
return realpath("$dir/$inst");
} }
return null; return null;
} }