Skip to content

Commit ed6dab2

Browse files
authored
Avoid accessing undefined variables in run-tests.php (#8669)
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.
1 parent 5a6436f commit ed6dab2

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

run-tests.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1802,13 +1802,8 @@ function run_test(string $php, $file, array $env): string
18021802
$org_file = $file;
18031803
$orig_php = $php;
18041804

1805-
if (isset($env['TEST_PHP_CGI_EXECUTABLE'])) {
1806-
$php_cgi = $env['TEST_PHP_CGI_EXECUTABLE'];
1807-
}
1808-
1809-
if (isset($env['TEST_PHPDBG_EXECUTABLE'])) {
1810-
$phpdbg = $env['TEST_PHPDBG_EXECUTABLE'];
1811-
}
1805+
$php_cgi = $env['TEST_PHP_CGI_EXECUTABLE'] ?? null;
1806+
$phpdbg = $env['TEST_PHPDBG_EXECUTABLE'] ?? null;
18121807

18131808
if (is_array($file)) {
18141809
$file = $file[0];
@@ -2489,6 +2484,8 @@ function run_test(string $php, $file, array $env): string
24892484
}
24902485
}
24912486

2487+
$wanted_headers = null;
2488+
$output_headers = null;
24922489
$failed_headers = false;
24932490

24942491
if ($test->hasSection('EXPECTHEADERS')) {
@@ -2647,6 +2644,8 @@ function run_test(string $php, $file, array $env): string
26472644
}
26482645
}
26492646

2647+
$restype = [];
2648+
26502649
if ($leaked) {
26512650
$restype[] = $test->hasSection('XLEAK') ?
26522651
'XLEAK' : 'LEAK';

0 commit comments

Comments
 (0)