From 5b559bbd84aecc53ad5bcb0c83eaf275bbcaedab Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Fri, 6 Jun 2003 18:38:14 +0000 Subject: [PATCH] Work around comma-in-string-form-of-random-index bug which appears when set to a locale with a comma as the decimal separator --- includes/SpecialRandompage.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 ); -- 2.20.1