Attempt to fix URL parsing edge case.

This commit is contained in:
Pachira 2023-09-11 19:25:12 +00:00
parent 923484c7ac
commit c57d2a49f2
3 changed files with 8 additions and 3 deletions

View file

@ -1 +1 @@
0.2309.80009
0.2309.111925

View file

@ -80,7 +80,7 @@ class HttpRequest extends HttpMessage {
$build = new HttpRequestBuilder;
$build->setHttpVersion(new Version(...array_map('intval', explode('.', substr($_SERVER['SERVER_PROTOCOL'], 5)))));
$build->setMethod($_SERVER['REQUEST_METHOD']);
$build->setPath('/' . trim(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH), '/'));
$build->setPath(parse_url('/' . trim($_SERVER['REQUEST_URI'], '/'), PHP_URL_PATH));
$build->setParams($_GET);
$build->setCookies($_COOKIE);

View file

@ -16,7 +16,12 @@ class Route {
private ?string $method;
private string $path;
/** @internal */
/**
* Creates a Route attribute.
*
* @param string $pathOrMethod Method name if this is registering a route, path if this is registering middleware.
* @param ?string $path Path if this registering a route, null if this is registering middleware.
*/
public function __construct(string $pathOrMethod, ?string $path = null) {
if($path === null) {
$this->method = null;