From b159096036c85fedf7b9c8d5dd064ab33cbba002 Mon Sep 17 00:00:00 2001
From: Jan-Hendrik Willms <tleilax+studip@gmail.com>
Date: Mon, 11 Jul 2022 13:02:01 +0000
Subject: [PATCH] fix property access, fixes #1297

Closes #1297

Merge request studip/studip!794
---
 lib/classes/restapi/RouteMap.php | 17 +++++++++++++----
 lib/classes/restapi/Router.php   |  6 +++---
 2 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/lib/classes/restapi/RouteMap.php b/lib/classes/restapi/RouteMap.php
index 62e3278a0b1..61e1fc2a2a8 100644
--- a/lib/classes/restapi/RouteMap.php
+++ b/lib/classes/restapi/RouteMap.php
@@ -199,10 +199,10 @@ abstract class RouteMap
      * Initializes the route map by binding it to a router and passing in
      * the current route.
      *
-     * @param RESTAPI\Router $router Router to bind this route map to
-     * @param Array          $route  The matched route out of
-     *                               Router::matchRoute; an array with keys
-     *                               'handler', 'conditions' and 'source'
+     * @param Router $router Router to bind this route map to
+     * @param array $route   The matched route out of Router::matchRoute;
+     *                       an array with keys 'handler', 'conditions' and
+     *                       'source'
      */
     public function init($router, $route)
     {
@@ -1039,4 +1039,13 @@ abstract class RouteMap
 
         return $conditions;
     }
+
+    /**
+     * Returns the response object
+     * @return Response
+     */
+    public function getResponse(): Response
+    {
+        return $this->response;
+    }
 }
diff --git a/lib/classes/restapi/Router.php b/lib/classes/restapi/Router.php
index ed00fd9d40d..3d375cba4ed 100644
--- a/lib/classes/restapi/Router.php
+++ b/lib/classes/restapi/Router.php
@@ -458,10 +458,10 @@ class Router
      * Takes a route and the parameters out of the requested path and
      * executes the handler of the route.
      *
-     * @param Array $route      the matched route out of
+     * @param array $route      the matched route out of
      *                          Router::matchRoute; an array with keys
      *                          'handler', 'conditions' and 'source'
-     * @param Array $parameters the matched parameters out of
+     * @param array $parameters the matched parameters out of
      *                          Router::matchRoute; something like:
      *                          `array('user_id' => '23a21d...e78f')`
      * @return Response  the resulting Response object which is then
@@ -496,7 +496,7 @@ class Router
             $handler[0]->after($this, $parameters);
         }
 
-        return $handler[0]->response;
+        return $handler[0]->getResponse();
     }
 
     /**
-- 
GitLab