diff options
author | Matthieu Napoli <matthieu@mnapoli.fr> | 2014-12-05 05:20:43 +0300 |
---|---|---|
committer | Matthieu Napoli <matthieu@mnapoli.fr> | 2014-12-05 05:20:43 +0300 |
commit | 80ab3b99438bc0d64a9c689e5ad71f585b3c0227 (patch) | |
tree | 51756aa5ac66272e49802b2da9ec3be17c62fd63 /core/Common.php | |
parent | e0871a1ddbd3cc803cc778484b334789e64cfd44 (diff) | |
parent | 3d8f3ce87b8dc58934717792576530dd3c457bfb (diff) |
Merge branch 'master' into log-refactoring-1
Conflicts:
CHANGELOG.md
Diffstat (limited to 'core/Common.php')
-rw-r--r-- | core/Common.php | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/core/Common.php b/core/Common.php index 7907d42b80..17368001d5 100644 --- a/core/Common.php +++ b/core/Common.php @@ -518,7 +518,13 @@ class Common */ public static function generateUniqId() { - return md5(uniqid(rand(), true)); + if (function_exists('mt_rand')) { + $rand = mt_rand(); + } else { + $rand = rand(); + } + + return md5(uniqid($rand, true)); } /** @@ -1182,10 +1188,12 @@ class Common } if (strpos(PHP_SAPI, '-fcgi') === false) { - $key = $_SERVER['SERVER_PROTOCOL']; + $key = 'HTTP/1.1'; - if (strlen($key) > 15 || empty($key)) { - $key = 'HTTP/1.1'; + if (array_key_exists('SERVER_PROTOCOL', $_SERVER) + && strlen($_SERVER['SERVER_PROTOCOL']) < 15 + && strlen($_SERVER['SERVER_PROTOCOL']) > 1) { + $key = $_SERVER['SERVER_PROTOCOL']; } } else { |