From: Aaron Schulz Date: Fri, 18 Mar 2016 19:11:45 +0000 (-0700) Subject: Avoid double-rendering on late exceptions X-Git-Tag: 1.31.0-rc.0~7479^2 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=4d673afd750991d0cc9d96023588ac7e238da93f;p=lhc%2Fweb%2Fwiklou.git Avoid double-rendering on late exceptions Bug: T129657 Change-Id: I86af834b842bc056b57b2a55a9e1385481d5781d --- diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 6774072d11..cffa744bae 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -2315,11 +2315,21 @@ class OutputPage extends ContextSource { // adding of CSS or Javascript by extensions. Hooks::run( 'BeforePageDisplay', [ &$this, &$sk ] ); - $sk->outputPage(); + try { + $sk->outputPage(); + } catch ( Exception $e ) { + ob_end_clean(); // bug T129657 + throw $e; + } } - // This hook allows last minute changes to final overall output by modifying output buffer - Hooks::run( 'AfterFinalPageOutput', [ $this ] ); + try { + // This hook allows last minute changes to final overall output by modifying output buffer + Hooks::run( 'AfterFinalPageOutput', [ $this ] ); + } catch ( Exception $e ) { + ob_end_clean(); // bug T129657 + throw $e; + } $this->sendCacheControl();