diff options
author | ArthurHoaro <arthur@hoa.ro> | 2016-02-19 20:20:33 +0100 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2016-02-19 20:20:33 +0100 |
commit | 7eb0a832018621b3662f9fb5c45c0a67f5936088 (patch) | |
tree | b5c83e131a07ca925950b127c3f375a1915abdf0 | |
parent | 7b63e4ca09f58b3b056bd2b8f2d8a4157537f274 (diff) | |
download | Shaarli-7eb0a832018621b3662f9fb5c45c0a67f5936088.tar.gz Shaarli-7eb0a832018621b3662f9fb5c45c0a67f5936088.tar.zst Shaarli-7eb0a832018621b3662f9fb5c45c0a67f5936088.zip |
Fixes #481: tag cloud fatal error
Only send LC_COLLATE to Collator and check that no error occured.
-rw-r--r-- | index.php | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -1218,11 +1218,12 @@ function renderPage() | |||
1218 | uksort($tags, function($a, $b) { | 1218 | uksort($tags, function($a, $b) { |
1219 | // Collator is part of PHP intl. | 1219 | // Collator is part of PHP intl. |
1220 | if (class_exists('Collator')) { | 1220 | if (class_exists('Collator')) { |
1221 | $c = new Collator(setlocale(LC_ALL, 0)); | 1221 | $c = new Collator(setlocale(LC_COLLATE, 0)); |
1222 | return $c->compare($a, $b); | 1222 | if (!intl_is_failure(intl_get_error_code())) { |
1223 | } else { | 1223 | return $c->compare($a, $b); |
1224 | return strcasecmp($a, $b); | 1224 | } |
1225 | } | 1225 | } |
1226 | return strcasecmp($a, $b); | ||
1226 | }); | 1227 | }); |
1227 | 1228 | ||
1228 | $tagList=array(); | 1229 | $tagList=array(); |