From 0436b61813619263c7bc32bee30b40c3cd859cc1 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Wed, 18 Dec 2013 16:56:34 +0100 Subject: [PATCH] Using PHP_EOL instead of php_uname() to determine version --- wcfsetup/install.php | 5 ++++- wcfsetup/install/files/lib/util/FileUtil.class.php | 7 +++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/wcfsetup/install.php b/wcfsetup/install.php index 612765b04d..96fa599263 100644 --- a/wcfsetup/install.php +++ b/wcfsetup/install.php @@ -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; diff --git a/wcfsetup/install/files/lib/util/FileUtil.class.php b/wcfsetup/install/files/lib/util/FileUtil.class.php index 5fc07f5d8d..2c7caccea7 100644 --- a/wcfsetup/install/files/lib/util/FileUtil.class.php +++ b/wcfsetup/install/files/lib/util/FileUtil.class.php @@ -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'; -- 2.20.1