Fixes #481: tag cloud fatal error

Only send LC_COLLATE to Collator and check that no error occured.
This commit is contained in:
ArthurHoaro 2016-02-19 20:20:33 +01:00
parent 7b63e4ca09
commit 7eb0a83201
1 changed files with 5 additions and 4 deletions

View File

@ -1218,11 +1218,12 @@ function renderPage()
uksort($tags, function($a, $b) {
// Collator is part of PHP intl.
if (class_exists('Collator')) {
$c = new Collator(setlocale(LC_ALL, 0));
return $c->compare($a, $b);
} else {
return strcasecmp($a, $b);
$c = new Collator(setlocale(LC_COLLATE, 0));
if (!intl_is_failure(intl_get_error_code())) {
return $c->compare($a, $b);
}
}
return strcasecmp($a, $b);
});
$tagList=array();