summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2012-10-11 08:47:40 +0200
committerAleksander Machniak <alec@alec.pl>2012-10-11 08:50:17 +0200
commit3508bebb8e5045a27f12c57d8d346d72b950a969 (patch)
tree08e11c5734425b117f3b451bef1ec73badf43af1
parent098bac55b21023754865bcaa3162006652034bf4 (diff)
Fix threaded list sorting on PHP < 5.2.9 (#1488748)
Conflicts: CHANGELOG
-rw-r--r--CHANGELOG1
-rw-r--r--program/include/rcube_result_thread.php10
2 files changed, 7 insertions, 4 deletions
diff --git a/CHANGELOG b/CHANGELOG
index ddee59698..f37d5af98 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -2,6 +2,7 @@ CHANGELOG Roundcube Webmail
===========================
- Fix Warning: htmlspecialchars(): charset `RCMAIL_CHARSET' not supported warning in Installer (#1488744)
+- Fix threaded list sorting on PHP < 5.2.9 (#1488748)
RELEASE 0.8.2
-------------
diff --git a/program/include/rcube_result_thread.php b/program/include/rcube_result_thread.php
index f8b0872f8..b939f678a 100644
--- a/program/include/rcube_result_thread.php
+++ b/program/include/rcube_result_thread.php
@@ -478,16 +478,18 @@ class rcube_result_thread
$items = explode(self::SEPARATOR_ITEM, $elem);
$root = (int) array_shift($items);
- $result[$elem] = $elem;
- foreach ($items as $item) {
- list($lv, $id) = explode(self::SEPARATOR_LEVEL, $item);
+ if ($root) {
+ $result[$root] = $root;
+ foreach ($items as $item) {
+ list($lv, $id) = explode(self::SEPARATOR_LEVEL, $item);
$result[$id] = $root;
+ }
}
}
// get only unique roots
$result = array_filter($result); // make sure there are no nulls
- $result = array_unique($result, SORT_NUMERIC);
+ $result = array_unique($result);
// Re-sort raw data
$result = array_fill_keys($result, null);