From 568bd6d1bf0eb65897ca1b21ab3c1d96a96727c7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Mat=C4=9Bj=20Such=C3=A1nek?= Date: Sun, 29 Jul 2018 11:54:45 +0200 Subject: [PATCH] Treat all time values on Special:Watchlist as floats PHP division may return float or int, depending on the operands. [1] Make sure all numbers are of the same type (floats), because XmlSelect compares values with ===. [1] http://php.net/manual/en/language.operators.arithmetic.php Bug: T199566 Change-Id: I37df6fd425f47d9a4562d83e04fcb50c3b97e0da (cherry picked from commit 4b75063d0eafeb9260f177cde782156a81b56f6b) --- includes/specials/SpecialWatchlist.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/specials/SpecialWatchlist.php b/includes/specials/SpecialWatchlist.php index 55a7f0391f..c266a80e05 100644 --- a/includes/specials/SpecialWatchlist.php +++ b/includes/specials/SpecialWatchlist.php @@ -772,7 +772,7 @@ class SpecialWatchlist extends ChangesListSpecialPage { ] ) ); asort( $hours ); - $select = new XmlSelect( 'days', 'days', $selectedHours / 24 ); + $select = new XmlSelect( 'days', 'days', (float)( $selectedHours / 24 ) ); foreach ( $hours as $value ) { if ( $value < 24 ) { @@ -780,7 +780,7 @@ class SpecialWatchlist extends ChangesListSpecialPage { } else { $name = $this->msg( 'days' )->numParams( $value / 24 )->text(); } - $select->addOption( $name, $value / 24 ); + $select->addOption( $name, (float)( $value / 24 ) ); } return $select->getHTML() . "\n
\n"; -- 2.20.1