From: Brion Vibber Date: Fri, 6 Jun 2003 18:38:14 +0000 (+0000) Subject: Work around comma-in-string-form-of-random-index bug which appears when set to a... X-Git-Tag: 1.1.0~498 X-Git-Url: http://git.cyclocoop.org/url?a=commitdiff_plain;h=5b559bbd84aecc53ad5bcb0c83eaf275bbcaedab;p=lhc%2Fweb%2Fwiklou.git Work around comma-in-string-form-of-random-index bug which appears when set to a locale with a comma as the decimal separator --- diff --git a/includes/SpecialRandompage.php b/includes/SpecialRandompage.php index 344000a211..9eadd041f0 100644 --- a/includes/SpecialRandompage.php +++ b/includes/SpecialRandompage.php @@ -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 );