Work around comma-in-string-form-of-random-index bug which appears when set to a...
authorBrion Vibber <brion@users.mediawiki.org>
Fri, 6 Jun 2003 18:38:14 +0000 (18:38 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Fri, 6 Jun 2003 18:38:14 +0000 (18:38 +0000)
includes/SpecialRandompage.php

index 344000a..9eadd04 100644 (file)
@@ -7,10 +7,12 @@ function wfSpecialRandompage()
 
        wfSeedRandom();
        $rand = mt_rand() / mt_getrandmax();
+       # interpolation and sprintf() can muck up with locale-specific decimal separator
+       $randstr = number_format( $rand, 12, ".", "" );
        $sqlget = "SELECT cur_id,cur_title
                FROM cur USE INDEX (cur_random)
                WHERE cur_namespace=0 AND cur_is_redirect=0
-               AND cur_random>$rand
+               AND cur_random>$randstr
                ORDER BY cur_random
                LIMIT 1";
        $res = wfQuery( $sqlget, $fname );