Browse code

[webmail] BM-12799 Fix: Use string order even for folder starting with a number

Mehdi Rande authored on 08/02/2018 10:10:17
Showing 1 changed files
... ...
@@ -1756,11 +1756,14 @@ class rcube_storage_bm extends rcube_imap {
1756 1756
               $folders[$folder] = rcube_charset_convert($folder, 'UTF7-IMAP');
1757 1757
             }
1758 1758
             // Replace delimiter with the first ascii char to use native sort on full path.
1759
-            $folders[$folder] =  str_replace($this->delimiter, "\0", $folders[$folder]);
1759
+            // But control chars are ignored by UCA... the first spacing char is \t and is not
1760
+            // likely to be used in a folder name...
1761
+            $folders[$folder] =  str_replace($this->delimiter, "\t", $folders[$folder]);
1760 1762
         }
1761 1763
         // Use a collator (need php lib to be added to bm php build) instead of custom function
1762 1764
         $collator = new Collator($this->options['language'] ?: 'en_US');
1763
-        $collator->asort($folders);
1765
+        $collator->asort($folders, Collator::SORT_STRING);
1766
+
1764 1767
         // sort folders
1765 1768
         $folders = array_keys($folders);
1766 1769