From: jenkins-bot Date: Thu, 6 Jul 2017 20:28:37 +0000 (+0000) Subject: Merge "Fix/hack ErrorPageError to work from non-UI contexts" X-Git-Tag: 1.31.0-rc.0~2779 X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=438df08478794114e7f40a5b62f09ca9ef21e880;hp=bbf910006b12846ba6388045b8b2f9e001384e8e Merge "Fix/hack ErrorPageError to work from non-UI contexts" --- diff --git a/includes/exception/ErrorPageError.php b/includes/exception/ErrorPageError.php index 2bed87af36..4b1812673f 100644 --- a/includes/exception/ErrorPageError.php +++ b/includes/exception/ErrorPageError.php @@ -61,9 +61,12 @@ class ErrorPageError extends MWException implements ILocalizedException { } public function report() { - global $wgOut; - - $wgOut->showErrorPage( $this->title, $this->msg, $this->params ); - $wgOut->output(); + if ( self::isCommandLine() || defined( 'MW_API' ) ) { + parent::report(); + } else { + global $wgOut; + $wgOut->showErrorPage( $this->title, $this->msg, $this->params ); + $wgOut->output(); + } } } diff --git a/tests/phpunit/includes/exception/ErrorPageErrorTest.php b/tests/phpunit/includes/exception/ErrorPageErrorTest.php index 71398e3f64..e72865f6be 100644 --- a/tests/phpunit/includes/exception/ErrorPageErrorTest.php +++ b/tests/phpunit/includes/exception/ErrorPageErrorTest.php @@ -43,6 +43,7 @@ class ErrorPageErrorTest extends MediaWikiTestCase { $mock->expects( $this->once() ) ->method( 'output' ); $this->setMwGlobals( 'wgOut', $mock ); + $this->setMwGlobals( 'wgCommandLineMode', false ); $e = new ErrorPageError( $title, $mockMessage, $params ); $e->report();