Closed codeclown closed 10 years ago
Sorry, I can not found this error in 2.4.0, May i know what is your version of slim framework ?
Strangely enough, it's 2.4.0. I guess it would be fixed simply by checking if getCurrentRoute()
returns null
before using it to include details in the table. It's weird though that you can't reproduce the error.
As said, it only happens when I go to an URL which doesn't match any route.
Um..In this case, I created a simple application like examples
and browse the not exists route. The app is correctly show the 404 not found to me not getCurrentRoute
error message.
Testing web server is Apache
I have no idea what's going on then. I looked at the example in this repo and the code is similar to mine. Meaning, the order of everything is exact.
Here's the function getCurrentRoute()
in Slim Framework:
/**
* Get Current Route object or the first matched one if matching has been performed
* @return \Slim\Route|null
*/
public function getCurrentRoute()
{
if ($this->currentRoute !== null) {
return $this->currentRoute;
}
if (is_array($this->matchedRoutes) && count($this->matchedRoutes) > 0) {
return $this->matchedRoutes[0];
}
return null;
}
I haven't yet dived into Slim enough to know the exact way the router works. Moreover, in what order things happen. I assume that, for some strange reason, the middleware is ran before a route is chosen. I have no idea why it happens to me, though, and only when navigating to a URL without a matching route.
Getting a
Whoops\Exception\ErrorException
as the title goes.File and line number:
vendor/zeuxisoo/slim-whoops/src/Zeuxisoo/Whoops/Provider/Slim/WhoopsMiddleware.php:31
Here is the actual line:
This only happens when I go to an URL that matches no route.