diff options
author | vipsoft <vipsoft@59fd770c-687e-43c8-a1e3-f5a4ff64c105> | 2009-03-29 00:37:30 +0300 |
---|---|---|
committer | vipsoft <vipsoft@59fd770c-687e-43c8-a1e3-f5a4ff64c105> | 2009-03-29 00:37:30 +0300 |
commit | eaf606f0cb1e81188dc83c0462982a1d3d0758a0 (patch) | |
tree | 811cc92ea2a8f7444fb3234a3886cbb899d64922 /core | |
parent | 9908f42db94bb14bc908df979e0b25256fc46b7a (diff) |
refs #504 - check that valid_languages and valid_countries is not null;
http://ca2.php.net/manual/en/function.in-array.php#86695 describes
in_array() returning true if haystack is 0 or false, and not in strict
mode
Diffstat (limited to 'core')
-rw-r--r-- | core/Common.php | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/core/Common.php b/core/Common.php index c3e167cffe..25c156efbe 100644 --- a/core/Common.php +++ b/core/Common.php @@ -677,7 +677,7 @@ class Piwik_Common } } - if(preg_match_all("/[-]([a-z]{2})/", $browserLanguage, $matches, PREG_SET_ORDER)) + if(!empty($validCountries) && preg_match_all("/[-]([a-z]{2})/", $browserLanguage, $matches, PREG_SET_ORDER)) { foreach($matches as $parts) { @@ -703,7 +703,7 @@ class Piwik_Common { // assumes language preference is sorted; // does not handle language-script-region tags or language range (*) - if(preg_match_all("/(?:^|,)([a-z]{2,3})([-][a-z]{2})?/", $browserLanguage, $matches, PREG_SET_ORDER)) + if(!empty($validLanguages) && preg_match_all("/(?:^|,)([a-z]{2,3})([-][a-z]{2})?/", $browserLanguage, $matches, PREG_SET_ORDER)) { foreach($matches as $parts) { |