mitigate accidental method route traversal

This commit is contained in:
Sky Johnson 2025-09-10 08:45:40 -05:00
parent 17bf93874b
commit 012d306d3a
2 changed files with 3 additions and 3 deletions

View File

@ -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": {

View File

@ -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;
}