Skip to content

Commit

Permalink
Fix: undefined array index for routes that don't have parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
gigili committed Sep 5, 2022
1 parent e99b86a commit 8ab92e2
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,8 @@ public function handle() : void {

private function get_route_arguments(array $route, string $path) : array {
$arguments = [];
if ( !isset($route["regex"]) ) return $arguments;

preg_match_all("/{$route['regex']}/", $path, $matches);
if ( count($matches) > 1 ) array_shift($matches);
$matches = array_map(fn($m) => $m[0], $matches);
Expand Down

0 comments on commit 8ab92e2

Please sign in to comment.