diff --git a/framework/core/src/Http/Server.php b/framework/core/src/Http/Server.php index 9c9e36ee8..b48a5e531 100644 --- a/framework/core/src/Http/Server.php +++ b/framework/core/src/Http/Server.php @@ -31,7 +31,7 @@ class Server public function listen() { - $app = $this->site->bootApp(); + $app = $this->safelyBootApp(); $runner = new RequestHandlerRunner( $app->getRequestHandler(), @@ -45,4 +45,18 @@ class Server ); $runner->run(); } + + /** + * Try to boot Flarum, and prevent exceptions from exposing sensitive info. + * + * @return \Flarum\Foundation\AppInterface + */ + private function safelyBootApp() + { + try { + return $this->site->bootApp(); + } catch (Throwable $e) { + exit('Error booting Flarum: '.$e->getMessage()); + } + } }