- Removed optional brackets from routes in UrlExtension.

This commit is contained in:
Dave M. 2022-12-08 19:10:43 +00:00
parent 3de5f46de6
commit 33298ff2e4
2 changed files with 14 additions and 2 deletions

View File

@ -234,6 +234,16 @@ PATTERN;
$route = str_replace(array_keys($search), array_values($search), $route);
}
/*
* @TODO - must also take into account that recursivity is possible here [/test[/another[/still]]],
* so the regex must be adjusted (or simply using another method could also be a possiblity)
* while(strpos($route, '[') !== false && strpos($route, ']') !== false ) {
if ( preg_match_all('~[(.*?)]~si', $route, $matches, PREG_SET_ORDER) ) {
}
}*/
$route = trim(str_replace([ '[', ']' ], '', $route), '/');
return $route;
}
}

View File

@ -69,11 +69,13 @@ class Picea implements LanguageRegistration
public function renderHtml(string $viewPath, array $variables = [], ?object $proxy = null) : ? string
{
$object = $this->gatherTemplateObject($viewPath, $variables, $proxy);
try {
return call_user_func($this->gatherTemplateObject($viewPath, $variables, $proxy));
return call_user_func($object);
}
catch(\Throwable $ex) {
throw $ex;
#throw $ex;
# Temporary class for an experiment on retrieving more accurate debug info
throw new class($object, $this, "An error occurred trying to render HTML view `$viewPath` : " . $ex->getMessage(), 911, $ex) extends \Exception {