Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 295112

4xx Recursion issue on non-existent html routes

$
0
0

Issue Summary

I've run into an error case related to rest, the rest_export view display, breadcrumb, and the way 4xx errors are handled in the routing system. The result is that REST resources without an html route can get stuck in an infinite recursion loop of Exceptions due to the html 4xx error page response.

Steps to Reproduce

  1. Create a rest_export view without an HTML format ex. /api/rest_export?_format=json . This resource will return a 400 error via the system.4xx route if accessed via /api/rest_export.
  2. Using the Bartik theme add the breadcrumbs block using the standard block layout.
  3. Now navigate to /api/rest_export and you'll trigger an infinite loop of NotAcceptableHttpException(s) from RequestFormatRouteFilter::filter() due to PathBasedBreadcrumbBuilder::getRequestForPath().

A stacktrace for the recursion for this request can be found at https://gist.github.com/malcolmp/d7bac0ed439c25bbf6bc9be357a7ddcb

Proposed Resolution

  1. Minimally patch system to catch ALL exceptions from $this->router->matchRequest($request) in PathBasedBreadcrumbBuilder::getRequestForPath() to prevent recursion in this specific case
  2. Ideally, the way 4xx errors are handled could be addressed to not use the sub-request in DefaultExceptionHtmlSubscriber::makeSubrequest() as that opens up to this kind of exception recursion. Otherwise, minimally catching exceptions to prevent recursion should be attempted.

A patch for #1 is attached. #2 is clearly a much bigger issue that I'm not quite clear how to resolve yet.


Viewing all articles
Browse latest Browse all 295112

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>