Skip to content

Commit 7e74fd7

Browse files
authored
Merge pull request #12 from samsonasik/fix-non-string-default-page
Fix non string value default page on PageRouter::pageBasedRoute()
2 parents d0e17bd + 76962f0 commit 7e74fd7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/PageRouter.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use CodeIgniter\HTTP\Exceptions\BadRequestException;
1919
use CodeIgniter\HTTP\ResponseInterface;
2020
use CodeIgniter\Router\Router;
21+
use RuntimeException;
2122

2223
/**
2324
* Page based router.
@@ -68,8 +69,12 @@ public function pageBasedRoute(string $uri)
6869
$uri = trim($uri, '/');
6970

7071
// Set default page for root uri
71-
if ($uri === '' || $uri === '0') {
72+
if ($uri === '') {
7273
$uri = config('App')->defaultPage ?? 'home';
74+
75+
if (! is_string($uri)) {
76+
throw new RuntimeException('App Config defaultPage must be a string.');
77+
}
7378
}
7479

7580
// Set default variables

0 commit comments

Comments
 (0)