RafaƂ Szklarczyk authored on 16/05/2024 13:46:13
Showing 2 changed files
... ...
@@ -181,8 +181,12 @@ class Application{
181 181
                 return $this->handle404($this->request);
182 182
             }
183 183
 
184
-            if(!is_null($module))
184
+            if(!is_null($module)){
185 185
                 $this->module = trim($module, '\\');
186
+            }
187
+            else{
188
+                $this->module = "";
189
+            }
186 190
             $this->controller = $controller;
187 191
             $this->action = $controller_action;
188 192
             // prepare args and start the action
... ...
@@ -113,7 +113,7 @@ class Router{
113 113
     public function match($request){
114 114
 
115 115
         if(is_null($request->path)){
116
-            $auri = array();
116
+            $auri = array(0 =>"");
117 117
         }
118 118
         else{
119 119
             $auri = explode('/', trim($request->path, "/ \t\n\r\0\x0B"));
... ...
@@ -126,7 +126,7 @@ class Router{
126 126
                 $method = $routeInfo->method;
127 127
                 if($method=='ANY' || strpos($request->method,$method)!==false){
128 128
                     if(is_null($route)){
129
-                        $aroute = array();
129
+                        $aroute = array(0=>"");
130 130
                     }
131 131
                     else{
132 132
                         $aroute = explode('/', trim($route, "/ \t\n\r\0\x0B"));
... ...
@@ -168,7 +168,7 @@ class Router{
168 168
                 $route_pattern = $routeInfo->path;
169 169
                 $method = $routeInfo->method;
170 170
                 if($method=='ANY' || strpos($request->method, $method)!==false){
171
-                    if(\preg_match($route_pattern, $request->path, $match, \PREG_OFFSET_CAPTURE)){
171
+                    if(!\is_null($request->path) && \preg_match($route_pattern, $request->path, $match, \PREG_OFFSET_CAPTURE)){
172 172
                         $this->parsedParameters = $this->cleanPregMatch($match);
173 173
                         $this->depth = $curi;
174 174
                         $this->routeInfo = $routeInfo;