Skip to content

Commit

Permalink
Avoid accessing undefined variables in run-tests.php
Browse files Browse the repository at this point in the history
The $php_cgi and $phpdbg cases here are definitely real bugs, and
caused the script to bail out under certain ini settings.

The other paths may actually be unreachable in practice, but were
highlighted by PhpStorm.
  • Loading branch information
IMSoP committed Jun 7, 2022
1 parent 5a6436f commit 5111f3e
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions run-tests.php
Original file line number Diff line number Diff line change
Expand Up @@ -1802,13 +1802,8 @@ function run_test(string $php, $file, array $env): string
$org_file = $file;
$orig_php = $php;

if (isset($env['TEST_PHP_CGI_EXECUTABLE'])) {
$php_cgi = $env['TEST_PHP_CGI_EXECUTABLE'];
}

if (isset($env['TEST_PHPDBG_EXECUTABLE'])) {
$phpdbg = $env['TEST_PHPDBG_EXECUTABLE'];
}
$php_cgi = $env['TEST_PHP_CGI_EXECUTABLE'] ?? null;
$phpdbg = $env['TEST_PHPDBG_EXECUTABLE'] ?? null;

if (is_array($file)) {
$file = $file[0];
Expand Down Expand Up @@ -2489,6 +2484,8 @@ function run_test(string $php, $file, array $env): string
}
}

$wanted_headers = null;
$output_headers = null;
$failed_headers = false;

if ($test->hasSection('EXPECTHEADERS')) {
Expand Down Expand Up @@ -2647,6 +2644,8 @@ function run_test(string $php, $file, array $env): string
}
}

$restype = [];

if ($leaked) {
$restype[] = $test->hasSection('XLEAK') ?
'XLEAK' : 'LEAK';
Expand Down

0 comments on commit 5111f3e

Please sign in to comment.