From: Tim Düsterhus Date: Tue, 13 Oct 2020 10:13:22 +0000 (+0200) Subject: Convert exceptions during stack trace parsing to InvalidArgumentException X-Git-Tag: 5.3.0_RC_2~19^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=727efac4dfb62b0f7e6e91b53aebbc6ae741eefc;p=GitHub%2FWoltLab%2FWCF.git Convert exceptions during stack trace parsing to InvalidArgumentException --- diff --git a/wcfsetup/install/files/lib/util/ExceptionLogUtil.class.php b/wcfsetup/install/files/lib/util/ExceptionLogUtil.class.php index 4090a7483d..36162b1c7d 100644 --- a/wcfsetup/install/files/lib/util/ExceptionLogUtil.class.php +++ b/wcfsetup/install/files/lib/util/ExceptionLogUtil.class.php @@ -1,5 +1,6 @@ match($entry)) { - throw new \InvalidArgumentException('The given entry is malformed'); + throw new \InvalidArgumentException('The given entry is malformed.'); } $matches = $regex->getMatches(); $chainRegex->match($matches['chain'], true, Regex::ORDER_MATCH_BY_SET); @@ -75,10 +76,20 @@ final class ExceptionLogUtil { $item['information'] = null; } else { - $item['information'] = unserialize(base64_decode($item['information']), ['allowed_classes' => false]); + try { + $item['information'] = unserialize(base64_decode($item['information']), ['allowed_classes' => false]); + } + catch (SystemException $e) { + throw new \InvalidArgumentException('The additional information section of the given entry is malformed.', 0, $e); + } } - $item['stack'] = JSON::decode($item['stack']); + try { + $item['stack'] = JSON::decode($item['stack']); + } + catch (SystemException $e) { + throw new \InvalidArgumentException('The stack trace of the given entry is malformed.', 0, $e); + } return $item; }, $chainRegex->getMatches());