mirror of
https://github.com/skipperbent/simple-php-router.git
synced 2026-06-17 08:47:52 +00:00
[BUGFIX] Only render group if prefix matches.
This commit is contained in:
@@ -86,7 +86,7 @@ class RouterBase {
|
|||||||
|
|
||||||
$this->currentRoute = $route;
|
$this->currentRoute = $route;
|
||||||
|
|
||||||
if($route instanceof RouterGroup && is_callable($route->getCallback())) {
|
if($route instanceof RouterGroup && $route->matchRoute($this->request) && is_callable($route->getCallback())) {
|
||||||
$group = $route;
|
$group = $route;
|
||||||
$route->renderRoute($this->request);
|
$route->renderRoute($this->request);
|
||||||
$mergedSettings = array_merge($route->getMergeableSettings(), $settings);
|
$mergedSettings = array_merge($route->getMergeableSettings(), $settings);
|
||||||
@@ -126,12 +126,6 @@ class RouterBase {
|
|||||||
|
|
||||||
$route = $this->controllerUrlMap[$i];
|
$route = $this->controllerUrlMap[$i];
|
||||||
|
|
||||||
if($route->getGroup() !== null) {
|
|
||||||
if($route->getGroup()->matchDomain($this->request) === false) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$routeMatch = $route->matchRoute($this->request);
|
$routeMatch = $route->matchRoute($this->request);
|
||||||
|
|
||||||
if($routeMatch) {
|
if($routeMatch) {
|
||||||
|
|||||||
@@ -66,7 +66,12 @@ class RouterGroup extends RouterEntry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function matchRoute(Request $request) {
|
public function matchRoute(Request $request) {
|
||||||
return null;
|
// Skip if prefix doesn't match
|
||||||
|
if($this->getPrefix() !== null && stripos($request->getUri(), $this->getPrefix()) === false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->matchDomain($request);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setExceptionHandler($class) {
|
public function setExceptionHandler($class) {
|
||||||
|
|||||||
Reference in New Issue
Block a user