Skip to content

Commit

Permalink
[jan] Fix warning if an old locale is longer than 255 characters (Bug…
Browse files Browse the repository at this point in the history
… #14489).
  • Loading branch information
yunosh committed Oct 14, 2016
1 parent 1b5dd41 commit 13d2342
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 11 additions & 1 deletion framework/Core/lib/Horde/Registry/Nlsconfig.php
Expand Up @@ -135,7 +135,17 @@ public function validLang($lang)
if (setlocale(LC_ALL, $lang . '.UTF-8')) {
$valid = true;
}
setlocale(LC_ALL, $locale);
if (strlen($locale) <= 255) {
setlocale(LC_ALL, $locale);
} else {
// Locale length is limited to 255 characters.
foreach (explode(';', $locale) as $lc) {
list($category, $catLocale) = explode('=', $lc);
if (defined($category)) {
setlocale(constant($category), $catLocale);
}
}
}
}
$GLOBALS['session']->set('horde', 'nls/valid_' . $lang, $valid);
}
Expand Down
2 changes: 2 additions & 0 deletions framework/Core/package.xml
Expand Up @@ -39,6 +39,7 @@
</stability>
<license uri="http://www.horde.org/licenses/lgpl21">LGPL-2.1</license>
<notes>
* [jan] Fix warning if an old locale is longer than 255 characters (Bug #14489).
* [jan] Fix abbreviated Norwegian month names in JavaScript to include trailing dot (Bug #14488).
* [jan] Fix reading session data from the command line with PHP 7.
</notes>
Expand Down Expand Up @@ -4275,6 +4276,7 @@
<date>2016-09-21</date>
<license uri="http://www.horde.org/licenses/lgpl21">LGPL-2.1</license>
<notes>
* [jan] Fix warning if an old locale is longer than 255 characters (Bug #14489).
* [jan] Fix abbreviated Norwegian month names in JavaScript to include trailing dot (Bug #14488).
* [jan] Fix reading session data from the command line with PHP 7.
</notes>
Expand Down

0 comments on commit 13d2342

Please sign in to comment.