]> granicus.if.org Git - php/commitdiff
Change PHP_OS_FAMILY slightly
authorKalle Sommer Nielsen <kalle@php.net>
Wed, 22 Feb 2017 11:31:06 +0000 (12:31 +0100)
committerKalle Sommer Nielsen <kalle@php.net>
Wed, 22 Feb 2017 11:31:06 +0000 (12:31 +0100)
* 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

25 files changed:
main/main.c
main/php.h
tests/basic/req60524-win.phpt
tests/basic/req60524.phpt
tests/output/sapi_windows_vt100_support_notwindows.phpt
tests/output/sapi_windows_vt100_support_winko_err.phpt
tests/output/sapi_windows_vt100_support_winko_in-err.phpt
tests/output/sapi_windows_vt100_support_winko_in-out-err.phpt
tests/output/sapi_windows_vt100_support_winko_in-out.phpt
tests/output/sapi_windows_vt100_support_winko_out-err.phpt
tests/output/sapi_windows_vt100_support_winko_out.phpt
tests/output/sapi_windows_vt100_support_winok_err.phpt
tests/output/sapi_windows_vt100_support_winok_in-err.phpt
tests/output/sapi_windows_vt100_support_winok_in-out-err.phpt
tests/output/sapi_windows_vt100_support_winok_in-out.phpt
tests/output/sapi_windows_vt100_support_winok_out-err.phpt
tests/output/sapi_windows_vt100_support_winok_out.phpt
tests/security/open_basedir_001.phpt
tests/security/open_basedir_link.phpt
tests/security/open_basedir_linkinfo.phpt
tests/security/open_basedir_mkdir.phpt
tests/security/open_basedir_parse_ini_file.phpt
tests/security/open_basedir_readlink.phpt
tests/security/open_basedir_realpath.phpt
tests/security/open_basedir_symlink.phpt

index 07144af906ccbfd36cfed17d5b4499546b0b3128..4e331ac2c8c089a7653776ae446dbeef95db0d2e 100644 (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);
index 23d365d9e3f74af0b1eb1aad6f2b8bde68c30038..fcf7b8cef5a199a1244bd7d9029251f5297cccb1 100644 (file)
 #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
index 8eb38a528c96f3f495b226044bddec526d3739c9..26fa9d9c5c7b15528f4af4a30afe4d6e948a889a 100644 (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--
index e4999e1a2036c8bca0486c06e2d18748757e1661..670940598ae296f166dcf9eb8be70466a2a6863a 100644 (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');
 }
 ?>
index d1afa4d9a3f37db967713461e5ce589a5853fb1a..cf4bf6fa6c9a6b1d8e258ed4336300bb00d2d438 100644 (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";
 }
 ?>
index 9c85a207257c2682a4ba3a2630c78148f4b42bc4..04dbef561e6d31f165cc4e64dffb432a39151fe1 100644 (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,
index 595b5c401f1c8e4cedf8d54952bc17e370ce6c3c..e83b51dff321e3405c0110ee876401619550d914 100644 (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,
index 44fae220ff7e5fbd2e6af08c48e49107eec389f2..fef672dda528ca5940c20d26d0e4652d1536ccdb 100644 (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,
index 322e7ad2297c3e40c11b822d29672c5f7d487a97..f8deab18e5d36431195c6716f99213455ca3dde9 100644 (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,
index e61652c13fbe6e5c0b56fcc0c570129b7f9106ad..7d72d9217e01fd8f6019b3114e1770aa0dba219f 100644 (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,
index 21966c8f648802f101bdd8110a80e9d3426c3260..d06a244e8238bf8f661edcd51e52295364af8a08 100644 (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,
index 26da5564b3ff0d93a69df904260c484cd08f1013..b05f7de753a2b23c37238371e89c9e03ba4842be 100644 (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,
index 646e169d9bfecb735be82bf840a2e4ec30ca6d2a..9699d5fd3c6134f7ab86fed20f484707696aac92 100644 (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,
index d277128095b3240ee5c7ab3f3bb1394225dd4c59..09bf3d154bbc6e3be3a36991ba6ef42c89088881 100644 (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,
index 1dd889aa053d36c206775ff7664598f1477dcd0b..81b6696b445fc63dfa08e266de8caa9ab059a4d6 100644 (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,
index e31b6881790dddf88d164d28fbbdd0428dd06aa9..2062007bf3cb36b2f9e1227424bc2826b3613019 100644 (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,
index 5379ac2059996fab8da685877e0749f0ce40e534..cc1f83fdfd029bf0a2824ade45d1c373dee10f13 100644 (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,
index 7b198df843807cd6f35d16d6c2584f0f930c6d4b..c4459686fbce30c1b28bc40250159f18340ef743 100644 (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")) {
index e03b23eb6082eb47a736b1916a4aea202d6c998b..57506d599b41af7c06af567a0d24f0368210eb16 100644 (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');
 }
 ?>
index 0f2b941e3ca6819095044a59fe2021e2476f3d16..5a532f845591dd5d452afb936b177c0ecaea311e 100644 (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');
 }
 ?>
index fba0dfbc0a9a1ac08d26ee42b4c5e6aafc936995..91cb3922068563a22b9cf08f042088838f34c27d 100644 (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');
 }
 ?>
index 5dec5f83a7e92897830a8116eb0bb99790e1f827..31ad1e5982c099d8d7efa68fbb22bbffa42230bf 100644 (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');
 }
 ?>
index 16c638a30745151f4a8247c5f29062ee0d9a759f..a2d892909de94040811a0cdaf8118417bf40a06b 100644 (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--
index c44215aa47f46965bf1bc5676bce0b8e0819aed2..9f56cd8005d10e89d70226005adbec1b3b8cf362 100644 (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');
 }
 ?>
index fe138cf9566afd8afd825393d12666e94ae6f3d4..ae431df2cadcb44c4e3247899adf7842f266c2b1 100644 (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--