mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
FIX: Ensure that Director::test() doesn't return a string
This commit is contained in:
parent
5734c2b3de
commit
b2dfa77056
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user