BUGFIX Prevent handling of controller actions which return $this avoid 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
This commit is contained in:
Sam Minnee 2010-10-13 01:24:53 +00:00
parent 740e49061f
commit 1d61bf7100

View File

@ -145,9 +145,10 @@ class RequestHandler extends ViewableData {
}
// 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