From c9bfb396123d2ad7deb90299ad5ae8d873341629 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Thu, 7 May 2015 21:23:31 +0300 Subject: [PATCH] Improved Windows detect --- scripts/Phalcon/Builder/Component.php | 2 +- scripts/Phalcon/Web/Tools.php | 4 ++-- scripts/Phalcon/Web/Tools/controllers/ControllerBase.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/Phalcon/Builder/Component.php b/scripts/Phalcon/Builder/Component.php index 65a55d2b9..7bf1a45ce 100644 --- a/scripts/Phalcon/Builder/Component.php +++ b/scripts/Phalcon/Builder/Component.php @@ -105,7 +105,7 @@ protected function _getConfig($path) */ public function isAbsolutePath($path) { - if (PHP_OS == "WINNT") { + if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { if (preg_match('/^[A-Z]:\\\\/', $path)) { return true; } diff --git a/scripts/Phalcon/Web/Tools.php b/scripts/Phalcon/Web/Tools.php index c769e187f..4e013beef 100644 --- a/scripts/Phalcon/Web/Tools.php +++ b/scripts/Phalcon/Web/Tools.php @@ -364,7 +364,7 @@ public static function install($path) $path = rtrim(realpath($path), '/') . '/'; $tools = realpath(__DIR__ . '/../../../'); - if (PHP_OS == 'WINNT') { + if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { $path = str_replace("\\", '/', $path); $tools = str_replace("\\", '/', $tools); } @@ -397,7 +397,7 @@ public static function install($path) public static function uninstall($path) { $path = realpath($path) . '/'; - if (PHP_OS == 'WINNT') { + if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { $path = str_replace("\\", '/', $path); } diff --git a/scripts/Phalcon/Web/Tools/controllers/ControllerBase.php b/scripts/Phalcon/Web/Tools/controllers/ControllerBase.php index ad7ac8cd5..fba81b3f6 100644 --- a/scripts/Phalcon/Web/Tools/controllers/ControllerBase.php +++ b/scripts/Phalcon/Web/Tools/controllers/ControllerBase.php @@ -151,7 +151,7 @@ private function checkToolsIp($ip) */ public function isAbsolutePath($path) { - if (PHP_OS == "WINNT") { + if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { if (preg_match('/^[A-Z]:\\\\/', $path)) { return true; }