Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Steur <thomas.steur@googlemail.com>2014-06-03 02:49:34 +0400
committerThomas Steur <thomas.steur@googlemail.com>2014-06-03 02:49:34 +0400
commit1191256f25abfaf92b746151239c79ee84acb151 (patch)
tree4d74c5f13227a434b90a79d1695884ebcc8c2b15 /core/Common.php
parentaebddae1125f8f3dfa59154634199578144cbfeb (diff)
refs #5007 display an error message in case console is executed as type CGI
Diffstat (limited to 'core/Common.php')
-rw-r--r--core/Common.php15
1 files changed, 14 insertions, 1 deletions
diff --git a/core/Common.php b/core/Common.php
index 876f6ff8e8..6156eb2ac1 100644
--- a/core/Common.php
+++ b/core/Common.php
@@ -129,7 +129,20 @@ class Common
$remoteAddr = @$_SERVER['REMOTE_ADDR'];
return PHP_SAPI == 'cli' ||
- (!strncmp(PHP_SAPI, 'cgi', 3) && empty($remoteAddr));
+ (self::isPhpCgiType() && empty($remoteAddr));
+ }
+
+ /**
+ * Returns true if PHP is executed as CGI type.
+ *
+ * @since added in 0.4.4
+ * @return bool true if PHP invoked as a CGI
+ */
+ public static function isPhpCgiType()
+ {
+ $sapiType = php_sapi_name();
+
+ return substr($sapiType, 0, 3) === 'cgi';
}
/**