Index: trunk/phase3/includes/Title.php |
— | — | @@ -4152,9 +4152,10 @@ |
4153 | 4153 | public function getCategorySortkey( $prefix = '' ) { |
4154 | 4154 | $unprefixed = $this->getText(); |
4155 | 4155 | if ( $prefix !== '' ) { |
4156 | | - # Separate with a null byte, so the unprefixed part is only used as |
4157 | | - # a tiebreaker when two pages have the exact same prefix -- null |
4158 | | - # sorts before everything else (hopefully). |
| 4156 | + # Separate with a line feed, so the unprefixed part is only used as |
| 4157 | + # a tiebreaker when two pages have the exact same prefix. |
| 4158 | + # In UCA, tab is the only character that can sort above LF |
| 4159 | + # so we strip both of them from the original prefix. |
4159 | 4160 | $prefix = strtr( $prefix, "\n\t", ' ' ); |
4160 | 4161 | return "$prefix\n$unprefixed"; |
4161 | 4162 | } |
Index: trunk/phase3/includes/Collation.php |
— | — | @@ -26,7 +26,7 @@ |
27 | 27 | * Given a string, convert it to a (hopefully short) key that can be used |
28 | 28 | * for efficient sorting. A binary sort according to the sortkeys |
29 | 29 | * corresponds to a logical sort of the corresponding strings. Current |
30 | | - * code expects that a null character should sort before all others, but |
| 30 | + * code expects that a line feed character should sort before all others, but |
31 | 31 | * has no other particular expectations (and that one can be changed if |
32 | 32 | * necessary). |
33 | 33 | * |
— | — | @@ -130,6 +130,9 @@ |
131 | 131 | } |
132 | 132 | |
133 | 133 | function getSortKey( $string ) { |
| 134 | + // intl extension produces non null-terminated |
| 135 | + // strings. Appending '' fixes it so that it doesn't generate |
| 136 | + // a warning on each access in debug php. |
134 | 137 | wfSuppressWarnings(); |
135 | 138 | $key = $this->mainCollator->getSortKey( $string ) . ''; |
136 | 139 | wfRestoreWarnings(); |