From 3353ca3e73b5ffe04b8bdb0fc148fe05f2cdf6ce Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Fri, 18 Nov 2016 11:50:03 +0100 Subject: [PATCH] Fixed exception output during WCFSetup --- wcfsetup/install.php | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/wcfsetup/install.php b/wcfsetup/install.php index 1b32b3b20b..e5f37d8c08 100644 --- a/wcfsetup/install.php +++ b/wcfsetup/install.php @@ -64,9 +64,10 @@ class SystemException extends \Exception implements IPrintableException { * @param string $message error message * @param integer $code error code * @param string $description description of the error + * @param \Exception $previous repacked Exception */ - public function __construct($message = '', $code = 0, $description = '') { - parent::__construct($message, $code); + public function __construct($message = '', $code = 0, $description = '', \Exception $previous = null) { + parent::__construct((string) $message, (int) $code, $previous); $this->description = $description; } @@ -327,39 +328,46 @@ class SystemException extends \Exception implements IPrintableException { getTrace(); + if (isset($trace[0]['function']) && $trace[0]['function'] === 'handleException') { + // ignore repacked exception + continue; + } + ?>
-

getPrevious() && !$first) { echo "Original "; } else if ($this->getPrevious() && $first) { echo "Final "; } ?>Error

- getDescription()) { ?> -

getDescription(); ?>

+

getPrevious() && !$first) { echo "Original "; } else if ($e->getPrevious() && $first) { echo "Final "; } ?>Error

+ getDescription()) { ?> +

getDescription(); ?>

getPrevious()); + } while ($e = $e->getPrevious()); + ?> ?> @@ -448,6 +457,10 @@ function handleException($e) { $e->show(); exit; } + + // repacking + (new SystemException($e->getMessage(), $e->getCode(), '', $e))->show(); + exit; } catch (\Throwable $exception) { die("
WCF::handleException() Unhandled exception: ".$exception->getMessage()."\n\n".$exception->getTraceAsString());
-- 
2.20.1