Change PHP_OS_FAMILY slightly

* PHP_OS_FAMILY is now a macro, to allow extensions to take advantage of it, it is defined in php.h
* Values are not upper-case-first, not always uppercase. Windows is no longer just "Win", if we want the short version for testing then PHP_OS is always WINNT anyway
This commit is contained in:
Kalle Sommer Nielsen 2017-02-22 12:31:06 +01:00
parent dbdb0819b2
commit f9959ee7c2
25 changed files with 41 additions and 44 deletions

View File

@ -2053,14 +2053,13 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod
zend_utility_functions zuf;
zend_utility_values zuv;
int retval = SUCCESS, module_number=0; /* for REGISTER_INI_ENTRIES() */
char *php_os, *php_os_family;
char *php_os;
zend_module_entry *module;
#ifdef PHP_WIN32
WORD wVersionRequested = MAKEWORD(2, 0);
WSADATA wsaData;
#endif
#ifdef PHP_WIN32
php_os = "WINNT";
old_invalid_parameter_handler =
@ -2075,21 +2074,6 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod
php_os = PHP_OS;
#endif
#if defined(PHP_WIN32)
php_os_family = "WIN";
#elif defined(BSD) || defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
php_os_family = "BSD";
#elif defined(__APPLE__) || defined(__MACH__)
php_os_family = "OSX";
#elif defined(__sun__)
php_os_family = "SOLARIS";
#elif defined(__linux__)
php_os_family = "LINUX";
#else
php_os_family = "unknown";
#endif
#ifdef ZTS
(void)ts_resource(0);
#endif
@ -2173,7 +2157,7 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod
#endif
REGISTER_MAIN_LONG_CONSTANT("PHP_DEBUG", PHP_DEBUG, CONST_PERSISTENT | CONST_CS);
REGISTER_MAIN_STRINGL_CONSTANT("PHP_OS", php_os, strlen(php_os), CONST_PERSISTENT | CONST_CS);
REGISTER_MAIN_STRINGL_CONSTANT("PHP_OS_FAMILY", php_os_family, strlen(php_os_family), CONST_PERSISTENT | CONST_CS);
REGISTER_MAIN_STRINGL_CONSTANT("PHP_OS_FAMILY", PHP_OS_FAMILY, sizeof(PHP_OS_FAMILY)-1, CONST_PERSISTENT | CONST_CS);
REGISTER_MAIN_STRINGL_CONSTANT("PHP_SAPI", sapi_module.name, strlen(sapi_module.name), CONST_PERSISTENT | CONST_CS);
REGISTER_MAIN_STRINGL_CONSTANT("DEFAULT_INCLUDE_PATH", PHP_INCLUDE_PATH, sizeof(PHP_INCLUDE_PATH)-1, CONST_PERSISTENT | CONST_CS);
REGISTER_MAIN_STRINGL_CONSTANT("PEAR_INSTALL_DIR", PEAR_INSTALLDIR, sizeof(PEAR_INSTALLDIR)-1, CONST_PERSISTENT | CONST_CS);

View File

@ -41,6 +41,19 @@
#undef sprintf
#define sprintf php_sprintf
/* Operating system family defintion */
#ifdef PHP_WIN32
# define PHP_OS_FAMILY "Windows"
#elif defined(BSD) || defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
# define PHP_OS_FAMILY "BSD"
#elif defined(__APPLE__) || defined(__MACH__)
# define PHP_OS_FAMILY "OSX"
#elif defined(__sun__)
# define PHP_OS_FAMILY "Solaris"
#elif defined(__linux__)
# define PHP_OS_FAMILY "Unknown"
#endif
/* PHP's DEBUG value must match Zend's ZEND_DEBUG value */
#undef PHP_DEBUG
#define PHP_DEBUG ZEND_DEBUG

View File

@ -4,7 +4,7 @@ Req #60524 (Specify temporary directory)
sys_temp_dir=C:\Windows
--SKIPIF--
<?php
if(PHP_OS_FAMILY !== "WIN")
if(PHP_OS_FAMILY !== "Windows")
die('skip Run only on Windows');
?>
--FILE--

View File

@ -4,7 +4,7 @@ Req #60524 (Specify temporary directory)
sys_temp_dir=/path/to/temp/dir
--SKIPIF--
<?php
if(PHP_OS_FAMILY === "WIN") {
if(PHP_OS_FAMILY === "Windows") {
die('skip non-windows only test');
}
?>

View File

@ -2,7 +2,7 @@
Test that sapi_windows_vt100_support exists only on Windows
--SKIPIF--
<?php
if(PHP_OS_FAMILY === "WIN") {
if(PHP_OS_FAMILY === "Windows") {
echo "skip Only for not Windows systems";
}
?>

View File

@ -5,7 +5,7 @@ Test sapi_windows_vt100_support on older Windows versions with redirected STDERR
if (getenv("SKIP_IO_CAPTURE_TESTS")) {
die("skip I/O capture test");
}
if(PHP_OS_FAMILY !== "WIN") {
if(PHP_OS_FAMILY !== "Windows") {
echo "skip Only for Windows systems";
} elseif (version_compare(
PHP_WINDOWS_VERSION_MAJOR.'.'.PHP_WINDOWS_VERSION_MINOR.'.'.PHP_WINDOWS_VERSION_BUILD,

View File

@ -5,7 +5,7 @@ Test sapi_windows_vt100_support on older Windows versions with redirected STDIN/
if (getenv("SKIP_IO_CAPTURE_TESTS")) {
die("skip I/O capture test");
}
if(PHP_OS_FAMILY !== "WIN") {
if(PHP_OS_FAMILY !== "Windows") {
echo "skip Only for Windows systems";
} elseif (version_compare(
PHP_WINDOWS_VERSION_MAJOR.'.'.PHP_WINDOWS_VERSION_MINOR.'.'.PHP_WINDOWS_VERSION_BUILD,

View File

@ -5,7 +5,7 @@ Test sapi_windows_vt100_support on older Windows versions with redirected STDIN/
if (getenv("SKIP_IO_CAPTURE_TESTS")) {
die("skip I/O capture test");
}
if(PHP_OS_FAMILY !== "WIN") {
if(PHP_OS_FAMILY !== "Windows") {
echo "skip Only for Windows systems";
} elseif (version_compare(
PHP_WINDOWS_VERSION_MAJOR.'.'.PHP_WINDOWS_VERSION_MINOR.'.'.PHP_WINDOWS_VERSION_BUILD,

View File

@ -5,7 +5,7 @@ Test sapi_windows_vt100_support on older Windows versions with redirected STDIN/
if (getenv("SKIP_IO_CAPTURE_TESTS")) {
die("skip I/O capture test");
}
if(PHP_OS_FAMILY !== "WIN") {
if(PHP_OS_FAMILY !== "Windows") {
echo "skip Only for Windows systems";
} elseif (version_compare(
PHP_WINDOWS_VERSION_MAJOR.'.'.PHP_WINDOWS_VERSION_MINOR.'.'.PHP_WINDOWS_VERSION_BUILD,

View File

@ -5,7 +5,7 @@ Test sapi_windows_vt100_support on older Windows versions with redirected STDOUT
if (getenv("SKIP_IO_CAPTURE_TESTS")) {
die("skip I/O capture test");
}
if(PHP_OS_FAMILY !== "WIN") {
if(PHP_OS_FAMILY !== "Windows") {
echo "skip Only for Windows systems";
} elseif (version_compare(
PHP_WINDOWS_VERSION_MAJOR.'.'.PHP_WINDOWS_VERSION_MINOR.'.'.PHP_WINDOWS_VERSION_BUILD,

View File

@ -5,7 +5,7 @@ Test sapi_windows_vt100_support on older Windows versions with redirected STDOUT
if (getenv("SKIP_IO_CAPTURE_TESTS")) {
die("skip I/O capture test");
}
if(PHP_OS_FAMILY !== "WIN") {
if(PHP_OS_FAMILY !== "Windows") {
echo "skip Only for Windows systems";
} elseif (version_compare(
PHP_WINDOWS_VERSION_MAJOR.'.'.PHP_WINDOWS_VERSION_MINOR.'.'.PHP_WINDOWS_VERSION_BUILD,

View File

@ -5,7 +5,7 @@ Test sapi_windows_vt100_support on newer Windows versions with redirected STDERR
if (getenv("SKIP_IO_CAPTURE_TESTS")) {
die("skip I/O capture test");
}
if(PHP_OS_FAMILY !== "WIN") {
if(PHP_OS_FAMILY !== "Windows") {
echo "skip Only for Windows systems";
} elseif (version_compare(
PHP_WINDOWS_VERSION_MAJOR.'.'.PHP_WINDOWS_VERSION_MINOR.'.'.PHP_WINDOWS_VERSION_BUILD,

View File

@ -5,7 +5,7 @@ Test sapi_windows_vt100_support on newer Windows versions with redirected STDIN/
if (getenv("SKIP_IO_CAPTURE_TESTS")) {
die("skip I/O capture test");
}
if(PHP_OS_FAMILY !== "WIN") {
if(PHP_OS_FAMILY !== "Windows") {
echo "skip Only for Windows systems";
} elseif (version_compare(
PHP_WINDOWS_VERSION_MAJOR.'.'.PHP_WINDOWS_VERSION_MINOR.'.'.PHP_WINDOWS_VERSION_BUILD,

View File

@ -5,7 +5,7 @@ Test sapi_windows_vt100_support on newer Windows versions with redirected STDIN/
if (getenv("SKIP_IO_CAPTURE_TESTS")) {
die("skip I/O capture test");
}
if(PHP_OS_FAMILY !== "WIN") {
if(PHP_OS_FAMILY !== "Windows") {
echo "skip Only for Windows systems";
} elseif (version_compare(
PHP_WINDOWS_VERSION_MAJOR.'.'.PHP_WINDOWS_VERSION_MINOR.'.'.PHP_WINDOWS_VERSION_BUILD,

View File

@ -5,7 +5,7 @@ Test sapi_windows_vt100_support on newer Windows versions with redirected STDIN/
if (getenv("SKIP_IO_CAPTURE_TESTS")) {
die("skip I/O capture test");
}
if(PHP_OS_FAMILY !== "WIN") {
if(PHP_OS_FAMILY !== "Windows") {
echo "skip Only for Windows systems";
} elseif (version_compare(
PHP_WINDOWS_VERSION_MAJOR.'.'.PHP_WINDOWS_VERSION_MINOR.'.'.PHP_WINDOWS_VERSION_BUILD,

View File

@ -5,7 +5,7 @@ Test sapi_windows_vt100_support on newer Windows versions with redirected STDOUT
if (getenv("SKIP_IO_CAPTURE_TESTS")) {
die("skip I/O capture test");
}
if(PHP_OS_FAMILY !== "WIN") {
if(PHP_OS_FAMILY !== "Windows") {
echo "skip Only for Windows systems";
} elseif (version_compare(
PHP_WINDOWS_VERSION_MAJOR.'.'.PHP_WINDOWS_VERSION_MINOR.'.'.PHP_WINDOWS_VERSION_BUILD,

View File

@ -5,7 +5,7 @@ Test sapi_windows_vt100_support on newer Windows versions with redirected STDOUT
if (getenv("SKIP_IO_CAPTURE_TESTS")) {
die("skip I/O capture test");
}
if(PHP_OS_FAMILY !== "WIN") {
if(PHP_OS_FAMILY !== "Windows") {
echo "skip Only for Windows systems";
} elseif (version_compare(
PHP_WINDOWS_VERSION_MAJOR.'.'.PHP_WINDOWS_VERSION_MINOR.'.'.PHP_WINDOWS_VERSION_BUILD,

View File

@ -2,7 +2,7 @@
openbase_dir runtime tightning
--SKIPIF--
<?php
if(PHP_OS_FAMILY === "WIN") {
if(PHP_OS_FAMILY === "Windows") {
die('skip.. only for unix');
}
if (!is_dir("/usr/local/bin")) {

View File

@ -2,7 +2,7 @@
Test open_basedir configuration
--SKIPIF--
<?php
if(PHP_OS_FAMILY === "WIN") {
if(PHP_OS_FAMILY === "Windows") {
die('skip no links on Windows');
}
?>

View File

@ -2,7 +2,7 @@
Test open_basedir configuration
--SKIPIF--
<?php
if(PHP_OS_FAMILY === "WIN") {
if(PHP_OS_FAMILY === "Windows") {
die('skip no symlinks on Windows');
}
?>

View File

@ -2,7 +2,7 @@
Test open_basedir configuration
--SKIPIF--
<?php
if(PHP_OS_FAMILY !== "WIN") {
if(PHP_OS_FAMILY !== "Windows") {
die('skip Windows only variation');
}
?>

View File

@ -4,7 +4,7 @@ Test open_basedir configuration
open_basedir=.
--SKIPIF--
<?php
if(PHP_OS_FAMILY !== "WIN") {
if(PHP_OS_FAMILY !== "Windows") {
die('skip Windows only variation');
}
?>

View File

@ -2,8 +2,8 @@
Test open_basedir configuration
--SKIPIF--
<?php
if(PHP_OS_FAMILY === "WIN") {
die('skip no symlinks on Windows');
if(PHP_OS_FAMILY === "Windows") {
die('skip not for Windows');
}
?>
--FILE--

View File

@ -2,7 +2,7 @@
Test open_basedir configuration
--SKIPIF--
<?php
if(PHP_OS_FAMILY !== "WIN") {
if(PHP_OS_FAMILY !== "Windows") {
die('skip only run on Windows');
}
?>

View File

@ -2,8 +2,8 @@
Test open_basedir configuration
--SKIPIF--
<?php
if(PHP_OS_FAMILY === "WIN") {
die('skip no symlinks on Windows');
if(PHP_OS_FAMILY === "Windows") {
die('skip not for Windows');
}
?>
--INI--