diff --git a/composer.json b/composer.json index 41916cc..77d0dde 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "sharkk/router", "description": "A simple node-based router.", - "version": "1.2.6", + "version": "1.2.7", "type": "library", "license": "MIT", "autoload": { diff --git a/src/Router.php b/src/Router.php index eb4f33a..ddb9801 100644 --- a/src/Router.php +++ b/src/Router.php @@ -71,8 +71,8 @@ class Router // we'll split up the URI into segments and traverse the node tree foreach (explode('/', trim($uri, '/')) as $segment) { - // if there is a node for this segment, move to it - if (isset($node[$segment])) { + // check that the next segment is an array (not a callable) and exists, then move to it + if (isset($node[$segment]) && is_array($node[$segment])) { $node = $node[$segment]; continue; }