From 1e4d675b16cf04d6f1f464936eb525a6796fb27a Mon Sep 17 00:00:00 2001 From: Sorawee Porncharoenwase Date: Sat, 22 Feb 2014 16:05:38 +0000 Subject: [PATCH] Prevent Special:Diff from processing empty string 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/specials/SpecialDiff.php b/includes/specials/SpecialDiff.php index bc0d7e3b85..77d23173ca 100644 --- a/includes/specials/SpecialDiff.php +++ b/includes/specials/SpecialDiff.php @@ -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]; -- 2.20.1