Commit 081af871 authored by alexpott's avatar alexpott

Issue #1987344 by tim.plunkett: NotFoundHttpException thrown in...

Issue #1987344 by tim.plunkett: NotFoundHttpException thrown in ParamConverterManager results in a WSOD.
parent 79ea2f38
......@@ -5,13 +5,13 @@
* API for the Drupal menu system.
*/
use Symfony\Component\HttpFoundation\Request;
use Drupal\Component\Utility\NestedArray;
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Template\Attribute;
use Drupal\menu_link\Plugin\Core\Entity\MenuLink;
use Drupal\menu_link\MenuLinkStorageController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
* @defgroup menu Menu system
......@@ -771,8 +771,15 @@ function _menu_translate(&$router_item, $map, $to_arg = FALSE) {
$route = $route_provider->getRouteByName($router_item['route_name']);
$request = Request::create('/' . $router_item['href']);
$request->attributes->set('system_path', $router_item['href']);
$request->attributes->add(Drupal::service('router')->matchRequest($request));
$router_item['access'] = Drupal::service('access_manager')->check($route, $request);
// Attempt to match this path to provide a fully built request to the
// acccess checker.
try {
$request->attributes->add(Drupal::service('router')->matchRequest($request));
$router_item['access'] = Drupal::service('access_manager')->check($route, $request);
}
catch (NotFoundHttpException $e) {
$router_item['access'] = FALSE;
}
}
else {
// @todo: Remove once all routes are converted.
......
......@@ -120,6 +120,10 @@ function testDefaultViews() {
// Ensure the view is no longer listed.
$this->assertUrl('admin/structure/views');
$this->assertNoLinkByHref($edit_href);
// Ensure the view is no longer available.
$this->drupalGet($edit_href);
$this->assertResponse(404);
$this->assertText('Page not found');
}
/**
......
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