Update comments to take into account r80443 and r80614 changes, per CR.
authorPlatonides <platonides@users.mediawiki.org>
Fri, 28 Jan 2011 22:27:52 +0000 (22:27 +0000)
committerPlatonides <platonides@users.mediawiki.org>
Fri, 28 Jan 2011 22:27:52 +0000 (22:27 +0000)
includes/Collation.php
includes/Title.php

index d579d58..f00b568 100644 (file)
@@ -26,7 +26,7 @@ abstract class Collation {
         * Given a string, convert it to a (hopefully short) key that can be used
         * for efficient sorting.  A binary sort according to the sortkeys
         * corresponds to a logical sort of the corresponding strings.  Current
-        * code expects that a null character should sort before all others, but
+        * code expects that a line feed character should sort before all others, but
         * has no other particular expectations (and that one can be changed if
         * necessary).
         *
@@ -130,6 +130,9 @@ class IcuCollation extends Collation {
        }
 
        function getSortKey( $string ) {
+               // intl extension produces non null-terminated
+               // strings. Appending '' fixes it so that it doesn't generate
+               // a warning on each access in debug php.
                wfSuppressWarnings();
                $key = $this->mainCollator->getSortKey( $string ) . '';
                wfRestoreWarnings();
index f67218d..102ce27 100644 (file)
@@ -4152,9 +4152,10 @@ class Title {
        public function getCategorySortkey( $prefix = '' ) {
                $unprefixed = $this->getText();
                if ( $prefix !== '' ) {
-                       # Separate with a null byte, so the unprefixed part is only used as
-                       # a tiebreaker when two pages have the exact same prefix -- null
-                       # sorts before everything else (hopefully).
+                       # Separate with a line feed, so the unprefixed part is only used as
+                       # a tiebreaker when two pages have the exact same prefix.
+                       # In UCA, tab is the only character that can sort above LF
+                       # so we strip both of them from the original prefix.
                        $prefix = strtr( $prefix, "\n\t", '  ' );
                        return "$prefix\n$unprefixed";
                }