diff --git a/system/Router/AutoRouterImproved.php b/system/Router/AutoRouterImproved.php index 6e0583d2a1e9..b6b81c70f2ef 100644 --- a/system/Router/AutoRouterImproved.php +++ b/system/Router/AutoRouterImproved.php @@ -125,6 +125,7 @@ private function createSegments(string $uri): array { $segments = explode('/', $uri); $segments = array_filter($segments, static fn ($segment) => $segment !== ''); + // numerically reindex the array, removing gaps return array_values($segments); } diff --git a/system/Router/RouteCollection.php b/system/Router/RouteCollection.php index 961369342bc5..82c6a6dd5bbe 100644 --- a/system/Router/RouteCollection.php +++ b/system/Router/RouteCollection.php @@ -1455,6 +1455,7 @@ protected function create(string $verb, string $from, $to, ?array $options = nul } $routeKey = $from; + // Replace our regex pattern placeholders with the actual thing // so that the Router doesn't need to know about any of this. foreach ($this->placeholders as $tag => $pattern) { diff --git a/tests/system/ControllerTest.php b/tests/system/ControllerTest.php index 73879dca9a2d..668cf9b1bc68 100644 --- a/tests/system/ControllerTest.php +++ b/tests/system/ControllerTest.php @@ -75,6 +75,7 @@ public function testConstructorHTTPS(): void { $original = $_SERVER; $_SERVER = ['HTTPS' => 'on']; + // make sure we can instantiate one try { $this->controller = new class () extends Controller {