Made wfBaseconvert actually work with $lowercase=false.
authorAaron Schulz <aschulz@wikimedia.org>
Tue, 25 Dec 2012 08:26:26 +0000 (00:26 -0800)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 25 Dec 2012 09:36:45 +0000 (09:36 +0000)
* This used to return false for any non-digit input characters.

Change-Id: Ie7fca2669724dea29f4733bbc77a559d4f48a5b1

includes/GlobalFunctions.php

index 9779cb8..208befe 100644 (file)
@@ -3200,7 +3200,7 @@ function wfBaseConvert( $input, $sourceBase, $destBase, $pad = 1, $lowercase = t
                $input == '' ) {
                return false;
        }
-       $digitChars = ( $lowercase ) ? '0123456789abcdefghijklmnopqrstuvwxyz' : '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
+       $digitChars = '0123456789abcdefghijklmnopqrstuvwxyz';
        $inDigits = array();
        $outChars = '';
 
@@ -3256,6 +3256,10 @@ function wfBaseConvert( $input, $sourceBase, $destBase, $pad = 1, $lowercase = t
                $outChars .= '0';
        }
 
+       if ( !$lowercase ) {
+               $outChars = strtoupper( $outChars );
+       }
+
        return strrev( $outChars );
 }