Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #20 from tomvb/main
Browse files Browse the repository at this point in the history
Fixing a bug in case of a Optional Route Subpattern
  • Loading branch information
mychidarko authored Sep 26, 2024
2 parents a2a8143 + e6c03f4 commit 63929b2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Router/Core.php
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ private static function findRoute(
// Extract the matched URL parameters (and only the parameters)
$params = array_map(function ($match, $index) use ($matches) {
// We have a following parameter: take the substring from the current param position until the next one's position (thank you PREG_OFFSET_CAPTURE)
if (isset($matches[$index + 1]) && isset($matches[$index + 1][0]) && is_array($matches[$index + 1][0])) {
if (isset($matches[$index + 1]) && isset($matches[$index + 1][0]) && $matches[$index + 1][0][1] != -1 && is_array($matches[$index + 1][0])) {
return trim(substr($match[0][0], 0, $matches[$index + 1][0][1] - $match[0][1]), '/');
}

Expand Down

0 comments on commit 63929b2

Please sign in to comment.