Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Unhandled URL-path results in an user warning in ModelAsController #2467

Closed
th3hamm0r opened this Issue · 3 comments

5 participants

@th3hamm0r

If you call call an action of a page with a long dir-path after the actual action, silverstripe throws a 404 error page (which is good), but also creates an user warning which spams the log.

We could reproduce this by calling the index-action of the home page, eg:
/home/index/test/test/test/test/test

Now we get following error:

[User Warning] popCurrent called on ModelAsController controller, but it wasn't at the top of the stack
GET /home/index/test/test/test/test/test

It looks like the line

return $this->httpError(404, "I can't handle sub-URLs of a $this->class object.");

in the RequestHandler::handleRequest() bypasses some important stack operations.

If we remove the "index/" path from the above URL, it does work.

@simonwelsh simonwelsh added the 3.1 label
@mediabeastnz

This is happening quite a lot on a few sites I manage.

@wilr
Collaborator

Working on this now.

@axllent

Thanks Will. It would be good if that warning wasn't logged as an error on a live website for a simple 404. It just tends to spam the error log with non-relevant stuff as @th3hamm0r said.

@wilr wilr referenced this issue from a commit in dnadesign/silverstripe-cms
@wilr wilr FIX ensure controller stack is updated when execution halted by an ex…
…ception.

See: silverstripe/silverstripe-framework#2467

popCurrent would be incorrectly not pop a controller from the controller stack if an exception was throw from inside the handleRequest() method.

This change captures the exception, ensures the controller is popped from the stack and passes the exception along.
a777266
@wilr wilr closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.