Remove the final IllegalLinkException from RequestHandler::handle()
authorTim Düsterhus <duesterhus@woltlab.com>
Thu, 13 Apr 2023 15:11:02 +0000 (17:11 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Fri, 14 Apr 2023 11:54:52 +0000 (13:54 +0200)
wcfsetup/install/files/lib/system/request/RequestHandler.class.php

index e02c96cf4c51a6ceca1cec2e69edb9be0c142726..8e8e602250cefb276b88e86244d8e7703f6bd465 100644 (file)
@@ -103,15 +103,15 @@ final class RequestHandler extends SingletonFactory
                 throw new NamedUserException('Failed to parse the incoming request.', 0, $e);
             }
 
-            if (!RouteHandler::getInstance()->matches()) {
+            if (RouteHandler::getInstance()->matches()) {
+                $builtRequest = $this->buildRequest($psrRequest, $application);
+            } else {
                 if (ENABLE_DEBUG_MODE) {
                     throw new SystemException("Cannot handle request, no valid route provided.");
-                } else {
-                    throw new IllegalLinkException();
                 }
-            }
 
-            $builtRequest = $this->buildRequest($psrRequest, $application);
+                $builtRequest = (new NotFoundHandler())->handle($psrRequest);
+            }
 
             if ($builtRequest instanceof Request) {
                 $this->activeRequest = $builtRequest;