From 957850f0da357337c24291a29d5ea0f08b5050a9 Mon Sep 17 00:00:00 2001 From: Brian Wolff Date: Tue, 20 Dec 2011 06:16:08 +0000 Subject: [PATCH] If you request LogEventList to display the combination of 2 log types, and one of those logs are restricted, will generate a warning, since it removes first entry of array, but doesn't re-index the array, and subsequent code makes assumptions of the form if ( count( $this->types ) $singleType = $this->types[0] (which doesn't work, as first index is 1). Thus cause array to be re-indexed if a $wgLogRestriction causes a log type to be removed. Steps to reproduce the issue is make deletion log restricted, then view a (non-existent) user page. Personally I think its kind of weird/wrong that if someone restricts both the move and delete log, then viewing a non-existent will give "This page has been deleted, here's delete log:" followed by an entry from *any* public log. --- RELEASE-NOTES-1.19 | 2 ++ includes/logging/LogEventsList.php | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/RELEASE-NOTES-1.19 b/RELEASE-NOTES-1.19 index d2e9b9943f..d02c67b6b7 100644 --- a/RELEASE-NOTES-1.19 +++ b/RELEASE-NOTES-1.19 @@ -185,6 +185,8 @@ production. * (bug 32414) Empty page get a empty bytes attribute in Export/Dump. * (bug 33101) Viewing a User or User talk of username resembling IP ending with .xxx causes Internal error +* Warning about undefined index in certain situations when $wgLogRestrictions + causes the first log type requested to be removed but not the others === API changes in 1.19 === * (bug 19838) siprop=interwikimap can now use the interwiki cache. diff --git a/includes/logging/LogEventsList.php b/includes/logging/LogEventsList.php index 0d31e403ec..5458bac189 100644 --- a/includes/logging/LogEventsList.php +++ b/includes/logging/LogEventsList.php @@ -826,13 +826,20 @@ class LogPager extends ReverseChronologicalPager { // If $types is not an array, make it an array $types = ($types === '') ? array() : (array)$types; // Don't even show header for private logs; don't recognize it... + $needReindex = false; foreach ( $types as $type ) { if( isset( $wgLogRestrictions[$type] ) && !$this->getUser()->isAllowed($wgLogRestrictions[$type]) ) { + $needReindex = true; $types = array_diff( $types, array( $type ) ); } } + if ( $needReindex ) { + // Lots of this code makes assumptions that + // the first entry in the array is $types[0]. + $types = array_values( $types ); + } $this->types = $types; // Don't show private logs to unprivileged users. // Also, only show them upon specific request to avoid suprises. -- 2.20.1