skipperbent / simple-php-router

Simple, fast and yet powerful PHP router that is easy to get integrated and in any project. Heavily inspired by the way Laravel handles routing, with both simplicity and expand-ability in mind.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

It throws an error when there is an unexpected value in the URL.

benfiratkaya opened this issue · comments

It throws an error when there is an unexpected value in the URL. And try catch not working.

    try {
      SimpleRouter::start();
    } catch (Expception $ex) {
      echo $ex->getMessage(); // NOT WORKING!
    }

URL: /dashboard/accounts/"/
Error:

Fatal error: Uncaught TypeError: Typed property Pecee\SimpleRouter\Route\Route::$parameters must be array, null used in /Users/firatkaya/PhpstormProjects/leaderos-v5-global/apps/dashboard/vendor/pecee/simple-router/src/Pecee/SimpleRouter/Route/RouteResource.php:109 Stack trace: #0 /Users/firatkaya/PhpstormProjects/leaderos-v5-global/apps/dashboard/vendor/pecee/simple-router/src/Pecee/SimpleRouter/Router.php(389): Pecee\SimpleRouter\Route\RouteResource->matchRoute('/dashboard/acco...', Object(Pecee\Http\Request)) #1 /Users/firatkaya/PhpstormProjects/leaderos-v5-global/apps/dashboard/vendor/pecee/simple-router/src/Pecee/SimpleRouter/Router.php(353): Pecee\SimpleRouter\Router->routeRequest() #2 /Users/firatkaya/PhpstormProjects/leaderos-v5-global/apps/dashboard/vendor/pecee/simple-router/src/Pecee/SimpleRouter/SimpleRouter.php(69): Pecee\SimpleRouter\Router->start() #3 /Users/firatkaya/PhpstormProjects/leaderos-v5-global/apps/dashboard/public/index.php(897): Pecee\SimpleRouter\SimpleRouter::start() #4 /Users/firatkaya/Phpsto in /Users/firatkaya/PhpstormProjects/leaderos-v5-global/apps/dashboard/vendor/pecee/simple-router/src/Pecee/SimpleRouter/Route/RouteResource.php on line 109
commented

The try/catch block is not working because you have mistyped Exception as Expception.
As for the error itself, I don't get that in my app, so it must have something to do with how you have set up your routes.