From: Matěj Suchánek Date: Fri, 8 Jun 2018 13:34:41 +0000 (+0000) Subject: Prevent "Undefined offset notice" X-Git-Tag: 1.34.0-rc.0~4910^2 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22auteur_infos%22%2C%22id_auteur=%24connect_id_auteur%22%29%20.%20%22?a=commitdiff_plain;h=1000236bb9f6060c4f51b52ecf0971d1a81ecc93;p=lhc%2Fweb%2Fwiklou.git Prevent "Undefined offset notice" The number provided by the query can be arbitrary, so let's narrow the input validation to booleans. Bug: T194616 Change-Id: If03e6e2d5bbcf4f2d85047cc23ee5388b39fe114 --- diff --git a/includes/logging/LogEventsList.php b/includes/logging/LogEventsList.php index 911a8cc71d..7b8ffef0e9 100644 --- a/includes/logging/LogEventsList.php +++ b/includes/logging/LogEventsList.php @@ -177,7 +177,7 @@ class LogEventsList extends ContextSource { $query = $this->getDefaultQuery(); $queryKey = "hide_{$type}_log"; - $hideVal = 1 - intval( $val ); + $hideVal = $val ? 0 : 1; $query[$queryKey] = $hideVal; $link = $linkRenderer->makeKnownLink( diff --git a/includes/logging/LogPager.php b/includes/logging/LogPager.php index 84653b1ba1..6b177aef9a 100644 --- a/includes/logging/LogPager.php +++ b/includes/logging/LogPager.php @@ -105,7 +105,7 @@ class LogPager extends ReverseChronologicalPager { return $filters; } foreach ( $wgFilterLogTypes as $type => $default ) { - $hide = $this->getRequest()->getInt( "hide_{$type}_log", $default ); + $hide = $this->getRequest()->getBool( "hide_{$type}_log", $default ); $filters[$type] = $hide; if ( $hide ) {