From a64652a3b9b1b514da4e073dfa8039c48341592e Mon Sep 17 00:00:00 2001 From: DHBW-AWZ-Admin <145437822+DHBW-AWZ-Admin@users.noreply.github.com> Date: Wed, 4 Mar 2026 13:47:28 +0100 Subject: [PATCH] Update class.Server.php Mantis-Bug: 47331: https://mantis.ilias.de/view.php?id=47331 ILIAS-Fehler: 1. TypeError thrown with message "ILIAS\COPage\Editor\Server\Server::getActionHandlerForCommand(): Argument #2 ($body) must be of type array, null given, called in components/ILIAS/COPage/Editor/Server/class.Server.php on line 76" 2. Whoops\Exception\ErrorException thrown with message "Undefined array key "component"" --- .../ILIAS/COPage/Editor/Server/class.Server.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/components/ILIAS/COPage/Editor/Server/class.Server.php b/components/ILIAS/COPage/Editor/Server/class.Server.php index 63f3f4f64272..4d27af1bf26b 100755 --- a/components/ILIAS/COPage/Editor/Server/class.Server.php +++ b/components/ILIAS/COPage/Editor/Server/class.Server.php @@ -73,6 +73,10 @@ public function reply(): void $response = $action_handler->handle($query); } else { //sleep(5); + // Argument #2 ($body) must be of type array, null given + if (!is_array($body)) { + $body = array(); + } $action_handler = $this->getActionHandlerForCommand($query, $body); $response = $action_handler->handle($query, $body); } @@ -115,8 +119,10 @@ protected function getActionHandlerForCommand( array $body ): CommandActionHandler { $handler = null; - - switch ($body["component"]) { + //Undefined array key "component + //switch ($body["component"]) { + $component = isset($body['component']) ? $body['component'] : null; + switch ($component) { case "Paragraph": $handler = new ParagraphCommandActionHandler($this->page_gui); break; @@ -157,7 +163,8 @@ protected function getActionHandlerForCommand( } if ($handler === null) { - throw new Exception("Unknown component " . ((string) $body["component"])); + // throw new Exception("Unknown component " . ((string) $body["component"])); + throw new Exception("Unknown component " . ((string) $component)) } return $handler; }