Handle trailing URL segments in router

Added logic to handle single trailing URL segments in the router, ensuring non-numeric segments are added to the `$_REQUEST` array if not already present. Improved URL parsing for consistent request handling.
This commit is contained in:
stephan.kasdorf
2025-08-29 14:15:16 +02:00
parent 197cab3691
commit b550605bc2

View File

@@ -1,5 +1,7 @@
<?php <?php
namespace Nibiru; namespace Nibiru;
use phpseclib3\File\ASN1\Maps\FieldElement;
/** /**
* User - stephan * User - stephan
* Date - 24.01.17 * Date - 24.01.17
@@ -250,7 +252,17 @@ class Router extends Config
} }
} }
} }
else
{
// Handle single trailing URL segments
if(!is_numeric($uri_parts[$i]) && !empty($uri_parts[$i]))
{
if(!array_key_exists($uri_parts[$i], $_REQUEST))
{
$_REQUEST[$uri_parts[$i]] = '';
}
}
}
} }
} }
} }