Using PHP_EOL instead of php_uname() to determine version
authorAlexander Ebert <ebert@woltlab.com>
Wed, 18 Dec 2013 15:56:34 +0000 (16:56 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Wed, 18 Dec 2013 15:56:34 +0000 (16:56 +0100)
wcfsetup/install.php
wcfsetup/install/files/lib/util/FileUtil.class.php

index 612765b04daba9cf652df96f5870f4e03bf20705..96fa599263de0bbb4027e3f60762b8905cd8e950 100644 (file)
@@ -308,10 +308,13 @@ class BasicFileUtil {
                // determine mode
                if (self::$mode === null) {
                        // do not use PHP_OS here, as this represents the system it was built on != running on
-                       if (strpos(php_uname(), 'Windows') !== false) {
+                       // php_uname() is forbidden on some strange hosts; PHP_EOL is reliable 
+                       if (PHP_EOL == "\r\n") {
+                               // Windows
                                self::$mode = 0777;
                        }
                        else {
+                               // anything but Windows
                                clearstatcache();
                                
                                self::$mode = 0666;
index 5fc07f5d8d78b260a7e7516bf86b2b9900e1ca7b..2c7caccea720245d14cb5d434e4c2dab8a728d56 100644 (file)
@@ -505,10 +505,13 @@ final class FileUtil {
                        // WCFSetup
                        if (defined('INSTALL_SCRIPT')) {
                                // do not use PHP_OS here, as this represents the system it was built on != running on
-                               if (strpos(php_uname(), 'Windows') !== false) {
-                                       self::$mode = '0777';
+                               // php_uname() is forbidden on some strange hosts; PHP_EOL is reliable 
+                               if (PHP_EOL == "\r\n") {
+                                       // Windows
+                                       self::$mode = 0777;
                                }
                                else {
+                                       // anything but Windows
                                        clearstatcache();
                                        
                                        self::$mode = '0666';