FIX ensure controller stack is updated when execution halted by an exception.

See: https://github.com/silverstripe/silverstripe-framework/issues/2467

popCurrent would be incorrectly not pop a controller from the controller stack if an exception was throw from inside the handleRequest() method.

This change captures the exception, ensures the controller is popped from the stack and passes the exception along.
This commit is contained in:
Will Rossiter 2014-07-01 14:18:53 +12:00
parent a1286f1c0f
commit a777266e43

View File

@ -193,8 +193,18 @@ class ContentController extends Controller {
}
Director::set_current_page($this->data());
$response = parent::handleRequest($request, $model);
Director::set_current_page(null);
try {
$response = parent::handleRequest($request, $model);
Director::set_current_page(null);
} catch(SS_HTTPResponse_Exception $e) {
$this->popCurrent();
Director::set_current_page(null);
throw $e;
}
}
return $response;