From 386e0aa4486309e2cd9200385d8a5c7b43b30512 Mon Sep 17 00:00:00 2001 From: Dave Mc Nicoll <info@mcnd.ca> Date: Fri, 9 Jun 2023 15:31:53 -0400 Subject: [PATCH] - Fixed error thrown on optional routes which arguments were not all fullfield --- src/Extension/UrlExtension.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Extension/UrlExtension.php b/src/Extension/UrlExtension.php index 82082b6..9cbb1c9 100644 --- a/src/Extension/UrlExtension.php +++ b/src/Extension/UrlExtension.php @@ -268,7 +268,7 @@ PATTERN; if ($default ?? false) { $value = $default; } - elseif ($this->enforceExistingArguments) {dump($routeParam); + elseif ( strpos($route, "[{$matches[0][0]}]") !== false && $this->enforceExistingArguments) { throw new \RuntimeException(sprintf("Error while preparing route %s : could not match variable '%s' into given arguments ( %s ) from %s::%s", $route, $variable, json_encode($arguments), $routeParam['class'], $routeParam['classMethod'])); } }