Issue #3316971 by Mile23, andypost: Ensure run-tests.sh works with future PHP versions

(cherry picked from commit fb0e14e172)
merge-requests/2710/merge
catch 2022-10-24 21:29:11 +01:00
parent 45461e7ac6
commit f4a08b7c7c
1 changed files with 5 additions and 1 deletions

View File

@ -545,7 +545,11 @@ function simpletest_script_init() {
if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
// Ensure that any and all environment variables are changed to https://.
foreach ($_SERVER as $key => $value) {
$_SERVER[$key] = str_replace('http://', 'https://', $_SERVER[$key]);
// Some values are NULL. Non-NULL values which are falsy will not contain
// text to replace.
if ($value) {
$_SERVER[$key] = str_replace('http://', 'https://', $value);
}
}
}