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

Twig function Path() returns RouteNotFoundException if route does not exists

$
0
0

Path() is a twig function which is used to generate a relative url path of the given route name. In case if route name does not exist or invalid, it returns an following exception:

The website encountered an unexpected error. Please try again later.Symfony\Component\Routing\Exception\RouteNotFoundException: Route "[ROUTE_NAME]" does not exist.

How to Reproduce.

  • use function path() in a twig file and pass a route_name and parameters in path() function
  • Now uninstall module that define route_name which is passed in path() twig function.
  • Reload Drupal page which load twig file where path() function is called.
  • Now you can see RouteNotFoundException

Proposed Solution

Path() function should return empty string or NULL if module that define route_name is not enabled.


Viewing all articles
Browse latest Browse all 296763

Trending Articles



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