FIX: RequestHandler::__construct() should run after middlewares (fixes #8848)

This commit is contained in:
Loz Calver 2019-03-11 11:07:41 +00:00
parent 19e5e9197f
commit ca781c684d
1 changed files with 4 additions and 5 deletions

View File

@ -352,12 +352,11 @@ class Director implements TemplateGlobalProvider
break;
}
/** @var RequestHandler $controllerObj */
$controllerObj = Injector::inst()->create($arguments['Controller']);
// Handler for calling a controller
$handler = function (HTTPRequest $request) use ($controllerObj) {
// Handler for constructing and calling a controller
$handler = function (HTTPRequest $request) use ($arguments) {
try {
/** @var RequestHandler $controllerObj */
$controllerObj = Injector::inst()->create($arguments['Controller']);
return $controllerObj->handleRequest($request);
} catch (HTTPResponse_Exception $responseException) {
return $responseException->getResponse();