From cfbb1bb50521ffc8ea97c284c5b9971f9e4160fe Mon Sep 17 00:00:00 2001 From: Timm Friebe Date: Sun, 12 Aug 2018 23:49:57 +0200 Subject: [PATCH] Wrap application setup in try/catch Fixes issue #46 --- ChangeLog.md | 3 +++ src/main/php/xp/web/WebRunner.class.php | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ChangeLog.md b/ChangeLog.md index 7449e910..8d172f89 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -5,6 +5,9 @@ Web change log ## 1.4.0 / 2018-08-12 +* Fixed issue #46: Uncaught exceptions from application setup in + development mode + (@thekid) * Merged PR #45: Pass all additional command line arguments to app environment (@thekid) diff --git a/src/main/php/xp/web/WebRunner.class.php b/src/main/php/xp/web/WebRunner.class.php index 8d73cf45..6a5b8934 100755 --- a/src/main/php/xp/web/WebRunner.class.php +++ b/src/main/php/xp/web/WebRunner.class.php @@ -70,7 +70,6 @@ private static function error($request, $response, $error, $profile) { /** @param string[] $args */ public static function main($args) { $env= new Environment($args[2], $args[0], $args[1], explode('PATH_SEPARATOR', getenv('WEB_CONFIG')), explode('|', getenv('WEB_ARGS'))); - $application= (new Source(getenv('WEB_SOURCE'), $env))->application(); $sapi= new SAPI(); $request= new Request($sapi); @@ -79,6 +78,7 @@ public static function main($args) { $response->header('Host', $request->header('Host')); try { + $application= (new Source(getenv('WEB_SOURCE'), $env))->application(); $application->service($request, $response); self::log($request, $response); } catch (Error $e) {