cross-solution / YAWIK

YAWIK is a web application. It can be used as an ATS applicant tracking system or as a jobboard.
https://yawik.org
MIT License
125 stars 67 forks source link

Non-existent URL returns HTTP 200 with empty body #208

Closed fedys closed 8 years ago

fedys commented 8 years ago

If you enter for example http://yawik.org/demo/en/non-existent you get HTTP 200 with empty body. Expected result would be HTTP 404 with simple body describing non-existent page.

TiSiE commented 8 years ago

Indeed. And the cause is the InjectSubnavigationListener, which throws the following exception while the error template is rendered:

EXCEPTION Could not get a Route Match. route is invalid. in /data/www/clients/client1/web1/YAWIK/module/Settings/src/Settings/Listener/InjectSubNavigationListener.php on line 48

fedys commented 8 years ago

I can try to fix it, ok?

TiSiE commented 8 years ago

Yes! Just silently exists instead of throwing an exception should be sufficient.

Please push to a new branch, I will then review and merge.

fedys commented 8 years ago

It's a deal

fedys commented 8 years ago

I've pushed 'http-404-fix' branch. I chose another approach because there were multiple places to fix missing RouteMatch during displaying the 404 page. So I create a dummy 'no-route' route on-fly in case of no route error. This way all templates/listeners can work as expected and there is no need to fix non-existing RouteMatch. I've already used this approach in several projects without any side-effects.

TiSiE commented 8 years ago

Just for reference: The relevant commit is: 4b751ab610ba509d21fd190578d1c2798a35c96f

@fedys If you include somthing like "refs gh-[issueNumber]" in your commits, github will automatically reference the commit in the issue thread.

fedys commented 8 years ago

Nice, I'll include it for the next time.