From 7cba74bb6c4b986d9e6ada2e6b34165d5bf7c392 Mon Sep 17 00:00:00 2001 From: Philipp Date: Sat, 27 Nov 2021 13:41:37 +0100 Subject: [PATCH] Fix that (raw)content is always executed during Module::run() --- src/BaseModule.php | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/src/BaseModule.php b/src/BaseModule.php index 46f21ed11..86dd5e7c0 100644 --- a/src/BaseModule.php +++ b/src/BaseModule.php @@ -220,23 +220,22 @@ abstract class BaseModule implements ICanHandleRequests case Router::PUT: $this->put(); break; - default: - $timestamp = microtime(true); - // "rawContent" is especially meant for technical endpoints. - // This endpoint doesn't need any theme initialization or other comparable stuff. - $this->rawContent($request); + } - try { - $arr = ['content' => '']; - Hook::callAll(static::class . '_mod_content', $arr); - $this->response->addContent($arr['content']); - $this->response->addContent($this->content($_REQUEST)); - } catch (HTTPException $e) { - $this->response->addContent((new ModuleHTTPException())->content($e)); - } finally { - $this->profiler->set(microtime(true) - $timestamp, 'content'); - } - break; + $timestamp = microtime(true); + // "rawContent" is especially meant for technical endpoints. + // This endpoint doesn't need any theme initialization or other comparable stuff. + $this->rawContent($request); + + try { + $arr = ['content' => '']; + Hook::callAll(static::class . '_mod_content', $arr); + $this->response->addContent($arr['content']); + $this->response->addContent($this->content($_REQUEST)); + } catch (HTTPException $e) { + $this->response->addContent((new ModuleHTTPException())->content($e)); + } finally { + $this->profiler->set(microtime(true) - $timestamp, 'content'); } return $this->response->generate();