From 19024619f63b3acd5cfdbbf03c26d150576432ff Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Fri, 2 Jan 2009 11:36:52 +0000 Subject: [PATCH] (bug 9243) Avoid exit to make MW handle page exceptions properly --- includes/Article.php | 2 +- includes/Wiki.php | 2 +- includes/diff/DifferenceEngine.php | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/includes/Article.php b/includes/Article.php index 456e3d98b1..d7cde1cc68 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -847,7 +847,7 @@ class Article { $wgOut->loginToUse(); $wgOut->output(); wfProfileOut( __METHOD__ ); - exit; + throw new MWException("Permission Error: you do not have access to view this page"); } # We're looking at an old revision diff --git a/includes/Wiki.php b/includes/Wiki.php index 9bb54c3a11..9060f23043 100644 --- a/includes/Wiki.php +++ b/includes/Wiki.php @@ -145,7 +145,7 @@ class MediaWiki { if( !is_null( $title ) && !$title->userCanRead() ) { $output->loginToUse(); $output->output(); - exit; + throw new MWException("Permission Error: you do not have access to view this page"); } } diff --git a/includes/diff/DifferenceEngine.php b/includes/diff/DifferenceEngine.php index 52b6c098cd..048b0b375b 100644 --- a/includes/diff/DifferenceEngine.php +++ b/includes/diff/DifferenceEngine.php @@ -148,11 +148,11 @@ CONTROL; $wgOut->setSubtitle( wfMsgExt( 'difference', array( 'parseinline' ) ) ); $wgOut->setRobotPolicy( 'noindex,nofollow' ); - if ( !( $this->mOldPage->userCanRead() && $this->mNewPage->userCanRead() ) ) { + if ( !$this->mOldPage->userCanRead() || !$this->mNewPage->userCanRead() ) { $wgOut->loginToUse(); $wgOut->output(); wfProfileOut( __METHOD__ ); - exit; + throw new MWException("Permission Error: you do not have access to view this page"); } $sk = $wgUser->getSkin(); @@ -423,11 +423,11 @@ CONTROL; # Check if user is allowed to look at this page. If not, bail out. # - if ( !( $this->mTitle->userCanRead() ) ) { + if ( !$this->mTitle->userCanRead() ) { $wgOut->loginToUse(); $wgOut->output(); wfProfileOut( __METHOD__ ); - exit; + throw new MWException("Permission Error: you do not have access to view this page"); } # Prepare the header box -- 2.20.1