Skip to content

Commit 9601fb7

Browse files
committed
run-tests: preserved skip-check environment isolation
1 parent 8e208dc commit 9601fb7

2 files changed

Lines changed: 23 additions & 4 deletions

File tree

run-tests.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2221,10 +2221,19 @@ function run_test(string $php, $file, array $env): string
22212221

22222222
if ($test->sectionNotEmpty('SKIPIF')) {
22232223
show_file_block('skip', $test->getSection('SKIPIF'));
2224+
$skipEnv = $env;
2225+
if (!IS_WINDOWS) {
2226+
unset(
2227+
$skipEnv['REQUEST_METHOD'],
2228+
$skipEnv['QUERY_STRING'],
2229+
$skipEnv['PATH_TRANSLATED'],
2230+
$skipEnv['SCRIPT_FILENAME'],
2231+
);
2232+
}
22242233

22252234
if ($valgrind) {
2226-
$env['USE_ZEND_ALLOC'] = '0';
2227-
$env['ZEND_DONT_UNLOAD_MODULES'] = 1;
2235+
$skipEnv['USE_ZEND_ALLOC'] = '0';
2236+
$skipEnv['ZEND_DONT_UNLOAD_MODULES'] = 1;
22282237
}
22292238

22302239
$junit->startTimer($shortname);
@@ -2246,7 +2255,7 @@ function run_test(string $php, $file, array $env): string
22462255
'-d',
22472256
'display_startup_errors=0',
22482257
];
2249-
$output = $skipCache->checkSkip($commandLine, $test->getSection('SKIPIF'), $test_skipif, $temp_skipif, $env);
2258+
$output = $skipCache->checkSkip($commandLine, $test->getSection('SKIPIF'), $test_skipif, $temp_skipif, $skipEnv);
22502259

22512260
$time = microtime(true) - $startTime;
22522261
$junit->stopTimer($shortname);

tests/run-test/clean_environment.phpt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
--TEST--
2-
CLEAN does not inherit request environment variables on POSIX
2+
SKIPIF and CLEAN do not inherit request environment variables on POSIX
3+
--SKIPIF--
4+
<?php
5+
if (PHP_OS_FAMILY !== 'Windows') {
6+
foreach (['REQUEST_METHOD', 'QUERY_STRING', 'PATH_TRANSLATED', 'SCRIPT_FILENAME'] as $name) {
7+
if (getenv($name) !== false) {
8+
die("$name was inherited\n");
9+
}
10+
}
11+
}
12+
?>
313
--FILE--
414
<?php
515
?>

0 commit comments

Comments
 (0)