Add {TMP} placeholder for PHPT INI sections

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.
This commit is contained in:
Christoph M. Becker 2019-05-08 17:54:02 +02:00
parent d19b6aa5ba
commit 3d0a0f801b

View file

@ -1604,9 +1604,8 @@ TEST $file
// Any special ini settings // Any special ini settings
// these may overwrite the test defaults... // these may overwrite the test defaults...
if (array_key_exists('INI', $section_text)) { 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); settings2array(preg_split( "/[\n\r]+/", $section_text['INI']), $ini_settings);
} }