From e0e6c9c74684d5e63fe172d15c8f79ca9cca998e Mon Sep 17 00:00:00 2001 From: Ori Livneh Date: Tue, 27 Jan 2015 20:38:57 -0800 Subject: [PATCH] Use PHP_OS rather than php_uname, which may be disabled A user just logged on to the #mediawiki channel to ask for help because his webhost disallowed php_uname(), causing wfIsWindows() to crash. Google autocompletes 'php_uname()' to 'php_uname() has been disabled for security reasons', so it is probably not uncommon. Consulting the PHP_OS constant instead side-steps the problem nicely. Change-Id: I8d63826db4fc5d142eac53717d4f9fbbf9928de9 --- includes/GlobalFunctions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 3be43b39cc..31bb0999e3 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -2459,7 +2459,7 @@ function wfTimestampNow() { function wfIsWindows() { static $isWindows = null; if ( $isWindows === null ) { - $isWindows = substr( php_uname(), 0, 7 ) == 'Windows'; + $isWindows = strtoupper( substr( PHP_OS, 0, 3 ) ) === 'WIN'; } return $isWindows; } -- 2.20.1