Discard previous output when an exception is thrown
authorAlexander Ebert <ebert@woltlab.com>
Thu, 25 Feb 2016 20:55:32 +0000 (21:55 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Thu, 25 Feb 2016 20:55:32 +0000 (21:55 +0100)
wcfsetup/install/files/lib/system/WCF.class.php

index f58f7851feecdf9d500a2627bde6cf078ddc5d4b..bc371f36af367bfd63c713083d31fbb38169d409 100644 (file)
@@ -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();