Skip to content

Commit c9bfb39

Browse files
committed
Improved Windows detect
1 parent 6469a6e commit c9bfb39

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

scripts/Phalcon/Builder/Component.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ protected function _getConfig($path)
105105
*/
106106
public function isAbsolutePath($path)
107107
{
108-
if (PHP_OS == "WINNT") {
108+
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
109109
if (preg_match('/^[A-Z]:\\\\/', $path)) {
110110
return true;
111111
}

scripts/Phalcon/Web/Tools.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ public static function install($path)
364364
$path = rtrim(realpath($path), '/') . '/';
365365
$tools = realpath(__DIR__ . '/../../../');
366366

367-
if (PHP_OS == 'WINNT') {
367+
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
368368
$path = str_replace("\\", '/', $path);
369369
$tools = str_replace("\\", '/', $tools);
370370
}
@@ -397,7 +397,7 @@ public static function install($path)
397397
public static function uninstall($path)
398398
{
399399
$path = realpath($path) . '/';
400-
if (PHP_OS == 'WINNT') {
400+
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
401401
$path = str_replace("\\", '/', $path);
402402
}
403403

scripts/Phalcon/Web/Tools/controllers/ControllerBase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ private function checkToolsIp($ip)
151151
*/
152152
public function isAbsolutePath($path)
153153
{
154-
if (PHP_OS == "WINNT") {
154+
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
155155
if (preg_match('/^[A-Z]:\\\\/', $path)) {
156156
return true;
157157
}

0 commit comments

Comments
 (0)