From f8434d25950d766c340e9381f5a825b403a05ca9 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Thu, 25 Feb 2016 21:55:32 +0100 Subject: [PATCH] Discard previous output when an exception is thrown --- wcfsetup/install/files/lib/system/WCF.class.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/wcfsetup/install/files/lib/system/WCF.class.php b/wcfsetup/install/files/lib/system/WCF.class.php index f58f7851fe..bc371f36af 100644 --- a/wcfsetup/install/files/lib/system/WCF.class.php +++ b/wcfsetup/install/files/lib/system/WCF.class.php @@ -237,6 +237,12 @@ class WCF { * @param \Exception $e */ public static final function handleException($e) { + if (ob_get_level()) { + // discard any output generated before the exception occured, prevents exception + // being hidden inside HTML elements and therefore not visible in browser output + ob_clean(); + } + // backwards compatibility if ($e instanceof IPrintableException) { $e->show(); -- 2.20.1