]> git.immae.eu Git - github/shaarli/Shaarli.git/commitdiff
Fixes #481: tag cloud fatal error 492/head
authorArthurHoaro <arthur@hoa.ro>
Fri, 19 Feb 2016 19:20:33 +0000 (20:20 +0100)
committerArthurHoaro <arthur@hoa.ro>
Fri, 19 Feb 2016 19:20:33 +0000 (20:20 +0100)
Only send LC_COLLATE to Collator and check that no error occured.

index.php

index 30e49cbb916bd51f0d8fd93aa721396f0147ff54..231b63f65bc5df8470aaeb79fe6b1864649a2a68 100644 (file)
--- 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();