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

Commit 63929b2

Browse files
authored
Merge pull request #20 from tomvb/main
Fixing a bug in case of a Optional Route Subpattern
2 parents a2a8143 + e6c03f4 commit 63929b2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Router/Core.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ private static function findRoute(
378378
// Extract the matched URL parameters (and only the parameters)
379379
$params = array_map(function ($match, $index) use ($matches) {
380380
// We have a following parameter: take the substring from the current param position until the next one's position (thank you PREG_OFFSET_CAPTURE)
381-
if (isset($matches[$index + 1]) && isset($matches[$index + 1][0]) && is_array($matches[$index + 1][0])) {
381+
if (isset($matches[$index + 1]) && isset($matches[$index + 1][0]) && $matches[$index + 1][0][1] != -1 && is_array($matches[$index + 1][0])) {
382382
return trim(substr($match[0][0], 0, $matches[$index + 1][0][1] - $match[0][1]), '/');
383383
}
384384

0 commit comments

Comments
 (0)