Skip to content

Commit

Permalink
Add {TMP} placeholder for PHPT INI sections
Browse files Browse the repository at this point in the history
Several tests use `/tmp` in the `--INI--` section, but this is not
portable.  We therefore introduce the `{TMP}` placeholder which
evaluates to the system's temporary directory using
`sys_get_temp_dir()`.

We also remove the doubtful `strpos()` optimization.
  • Loading branch information
cmb69 committed May 8, 2019
1 parent d19b6aa commit 3d0a0f8
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions run-tests.php
Expand Up @@ -1604,9 +1604,8 @@ function run_test($php, $file, $env)
// Any special ini settings
// these may overwrite the test defaults...
if (array_key_exists('INI', $section_text)) {
if (strpos($section_text['INI'], '{PWD}') !== false) {
$section_text['INI'] = str_replace('{PWD}', dirname($file), $section_text['INI']);
}
$section_text['INI'] = str_replace('{PWD}', dirname($file), $section_text['INI']);
$section_text['INI'] = str_replace('{TMP}', sys_get_temp_dir(), $section_text['INI']);
settings2array(preg_split( "/[\n\r]+/", $section_text['INI']), $ini_settings);
}

Expand Down

0 comments on commit 3d0a0f8

Please sign in to comment.