Define IS_WINDOWS in the test runner - #4866
Conversation
Avoid code duplication
| if (array_key_exists('CGI', $section_text) || !empty($section_text['GET']) || !empty($section_text['POST']) || !empty($section_text['GZIP_POST']) || !empty($section_text['DEFLATE_POST']) || !empty($section_text['POST_RAW']) || !empty($section_text['PUT']) || !empty($section_text['COOKIE']) || !empty($section_text['EXPECTHEADERS'])) { | ||
| if (isset($php_cgi)) { | ||
| $php = $php_cgi . ' -C '; | ||
| } else if (!strncasecmp(PHP_OS, "win", 3) && file_exists(dirname($php) . "/php-cgi.exe")) { |
There was a problem hiding this comment.
I suppose the usage of strncasecmp() is irrelevant compared to substr() but it is weird seeing it.
| // Parallel testing | ||
| global $workers, $workerID; | ||
|
|
||
| define('IS_WINDOWS', substr(PHP_OS, 0, 3) == "WIN"); |
There was a problem hiding this comment.
I personally think this is cleaner:
PHP_OS_FAMILY == 'Windows'
The substr() call has always been rather redundant for Windows unless you wanted to differentiate between Windows NT and Windows 9x series.
Either way I'm fine with this change overall
There was a problem hiding this comment.
PHP_OS_FAMILY is in 7.2, but run-tests is currently compatible with 7.0.
There was a problem hiding this comment.
PHP_OS_FAMILY is in 7.2, but run-tests is currently compatible with 7.0.
As this is targeting master shouldn't this be alright? Or is run-tests used version agnostic?
There was a problem hiding this comment.
Context: #3981
We can bump the minimum version requirement, I'm just saying that this is the status quo.
Avoid code duplication Closes phpGH-4866.
Avoid code duplication