If you request LogEventList to display the combination of 2 log types, and one of
authorBrian Wolff <bawolff@users.mediawiki.org>
Tue, 20 Dec 2011 06:16:08 +0000 (06:16 +0000)
committerBrian Wolff <bawolff@users.mediawiki.org>
Tue, 20 Dec 2011 06:16:08 +0000 (06:16 +0000)
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
includes/logging/LogEventsList.php

index d2e9b99..d02c67b 100644 (file)
@@ -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.
index 0d31e40..5458bac 100644 (file)
@@ -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.