From 1000236bb9f6060c4f51b52ecf0971d1a81ecc93 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Mat=C4=9Bj=20Such=C3=A1nek?= Date: Fri, 8 Jun 2018 13:34:41 +0000 Subject: [PATCH] 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 --- includes/logging/LogEventsList.php | 2 +- includes/logging/LogPager.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 ) { -- 2.20.1