From 2711ca8c3c39b9dac3210238c2c86731e99b27b8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Sat, 19 Jul 2014 15:29:51 +0200 Subject: [PATCH] Fix ExceptionLogViewPage erroring out when passed invalid logfile Closes #1762 --- .../acp/page/ExceptionLogViewPage.class.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/wcfsetup/install/files/lib/acp/page/ExceptionLogViewPage.class.php b/wcfsetup/install/files/lib/acp/page/ExceptionLogViewPage.class.php index 11ecfc76e7..a5b1be064e 100644 --- a/wcfsetup/install/files/lib/acp/page/ExceptionLogViewPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/ExceptionLogViewPage.class.php @@ -117,12 +117,18 @@ class ExceptionLogViewPage extends MultipleLinkPage { $contents = $split->split($contents, Regex::SPLIT_NON_EMPTY_ONLY | Regex::CAPTURE_SPLIT_DELIMITER); // even items become keys, odd items become values - $this->exceptions = call_user_func_array('array_merge', array_map( - function($v) { - return array($v[0] => $v[1]); - }, - array_chunk($contents, 2) - )); + try { + $this->exceptions = call_user_func_array('array_merge', array_map( + function($v) { + return array($v[0] => $v[1]); + }, + array_chunk($contents, 2) + )); + } + catch (\Exception $e) { + // logfile contents are pretty malformed, abort + return; + } if ($this->exceptionID) $this->searchPage($this->exceptionID); $this->calculateNumberOfPages(); -- 2.20.1