route: catch the regex syntax error correctely

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@3731 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2017-05-29 12:15:23 +00:00
parent 59ff1d7a57
commit 484a892836

View File

@@ -488,7 +488,13 @@ class route
else
$regex = str_replace ("}", ">[^/]+)", $regex);
unset ($matches);
$rcRegex = preg_match ($regex, $url, $matches);
$rcRegex = @preg_match ($regex, $url, $matches);
if ($rcRegex === false)
{
if (count (error_get_last()))
throw new \Exception ("Invalid regex provided: $regex : ".
error_get_last()["message"], 500);
}
if ($rcRegex !== FALSE && $rcRegex !== 0)
{
if ($this->debug)