Commit 3edf21c2 authored by Crell's avatar Crell
Browse files

Reset the static menu system variables before a subrequest.

parent 71e0447b
......@@ -104,6 +104,22 @@ public function on403Html(FlattenException $exception, Request $request) {
$subrequest = Request::create('/' . $path, 'get', array('destination' => $system_path), $request->cookies->all(), array(), $request->server->all());
// The active trail is being statically cached from the parent request to
// the subrequest, like any other static. Unfortunately that means the
// data in it is incorrect and does not get regenerated correctly for
// the subrequest. In this instance, that even causes a fatal error in
// some circumstances because menu_get_active_trail() ends up having
// a missing localized_options value. To work around that, reset the
// menu static variables and let them be regenerated as needed.
// @todo It is likely that there are other such statics that need to be
// reset that are not triggering test failures right now. If found,
// add them here.
// @todo Refactor the breadcrumb system so that it does not rely on static
// variables in the first place, which will eliminate the need for this
// hack.
$response = $this->kernel->handle($subrequest, DrupalKernel::SUB_REQUEST);
$response->setStatusCode(403, 'Access denied');
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment