From: ArthurHoaro Date: Fri, 19 Feb 2016 19:20:33 +0000 (+0100) Subject: Fixes #481: tag cloud fatal error X-Git-Tag: v0.6.4~5^2 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=refs%2Fpull%2F492%2Fhead;p=github%2Fshaarli%2FShaarli.git Fixes #481: tag cloud fatal error Only send LC_COLLATE to Collator and check that no error occured. --- diff --git a/index.php b/index.php index 30e49cbb..231b63f6 100644 --- a/index.php +++ b/index.php @@ -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();