Prevent Special:Diff from processing empty string
authorSorawee Porncharoenwase <nullzero.free@gmail.com>
Sat, 22 Feb 2014 16:05:38 +0000 (16:05 +0000)
committerSorawee Porncharoenwase <nullzero.free@gmail.com>
Sat, 22 Feb 2014 16:14:54 +0000 (16:14 +0000)
Umherirrender found that I77fdaf8e has a flaw. Currently it is possible
to go to index.php?title=Special:Diff (without any trailing string),
and the page will be redirected to index.php?diff= which is the last diff
of the main page. However, the intended way to deal with this case is to
raise ErrorPageError. This patch fixes the problem.

Change-Id: I3ff0b11671f27e77d9068930338ec8bbb674a89f

includes/specials/SpecialDiff.php

index bc0d7e3..77d2317 100644 (file)
@@ -46,7 +46,7 @@ class SpecialDiff extends RedirectSpecialPage {
                $parts = explode( '/', $subpage );
 
                // Try to parse the values given, generating somewhat pretty URLs if possible
-               if ( count( $parts ) === 1 ) {
+               if ( count( $parts ) === 1 && $parts[0] !== '' ) {
                        $this->mAddedRedirectParams['diff'] = $parts[0];
                } elseif ( count( $parts ) === 2 ) {
                        $this->mAddedRedirectParams['oldid'] = $parts[0];