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

View file

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