From b2dfa7705607e156124c0ab4216d1b1df7e5a6a4 Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Mon, 25 Feb 2013 16:27:44 +1300 Subject: [PATCH] FIX: Ensure that Director::test() doesn't return a string --- control/Director.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/control/Director.php b/control/Director.php index 42cfadb73..0d3739da1 100644 --- a/control/Director.php +++ b/control/Director.php @@ -224,6 +224,17 @@ class Director implements TemplateGlobalProvider { if($headers) foreach($headers as $k => $v) $request->addHeader($k, $v); // TODO: Pass in the DataModel $result = Director::handleRequest($request, $session, DataModel::inst()); + + // Ensure that the result is an SS_HTTPResponse object + if(is_string($result)) { + if(substr($result,0,9) == 'redirect:') { + $response = new SS_HTTPResponse(); + $response->redirect(substr($result, 9)); + $result = $response; + } else { + $result = new SS_HTTPResponse($result); + } + } // Restore the superglobals $_REQUEST = $existingRequestVars;