Permalink
Browse files

BUGFIX Prevent handling of controller actions which return $this avoi…

…d infinite loops in RequestHandler->handleRequest (thanks Hamish!) (from r102004)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112054 467b73ca-7a2a-4603-9d3b-597d59a354a9
  • Loading branch information...
1 parent 740e490 commit 1d61bf7100b34d30c0af807c9b61b65a19705162 @sminnee sminnee committed Oct 13, 2010
Showing with 4 additions and 3 deletions.
  1. +4 −3 core/control/RequestHandler.php
@@ -145,9 +145,10 @@ function handleRequest(SS_HTTPRequest $request) {
}
// If we return a RequestHandler, call handleRequest() on that, even if there is no more URL to parse.
- // It might have its own handler. However, we only do this if we haven't just parsed an empty rule ourselves,
- // to prevent infinite loops
- if(!$request->isEmptyPattern($rule) && is_object($result) && $result instanceof RequestHandler) {
+ // It might have its own handler. However, we only do this if we haven't just parsed an empty rule ourselves,
+ // to prevent infinite loops. Also prevent further handling of controller actions which return themselves
+ // to avoid infinite loops.
+ if($this !== $result && !$request->isEmptyPattern($rule) && is_object($result) && $result instanceof RequestHandler) {
$returnValue = $result->handleRequest($request);
// Array results can be used to handle

0 comments on commit 1d61bf7

Please sign in to comment.