diff --git a/Message/Http/Request.php b/Message/Http/Request.php index 4f57af851..5ce28b8f1 100644 --- a/Message/Http/Request.php +++ b/Message/Http/Request.php @@ -212,6 +212,7 @@ class Request extends RequestAbstract UriFactory::setQuery(':user', $this->uri->getUser()); UriFactory::setQuery(':pass', $this->uri->getPass()); + // todo: flush previous foreach($this->data as $key => $value) { UriFactory::setQuery('?' . $key, $value); } diff --git a/Uri/Http.php b/Uri/Http.php index 9b2846424..8d0c9b6cf 100644 --- a/Uri/Http.php +++ b/Uri/Http.php @@ -150,27 +150,26 @@ class Http implements UriInterface $this->uri = $uri; $url = parse_url($this->uri); - $this->scheme = $url['scheme'] ?? ''; - $this->host = $url['host'] ?? null; - $this->port = $url['port'] ?? null; - $this->user = $url['user'] ?? null; - $this->pass = $url['pass'] ?? null; - $this->path = $url['path'] ?? null; + $this->scheme = $url['scheme'] ?? ''; + $this->host = $url['host'] ?? null; + $this->port = $url['port'] ?? null; + $this->user = $url['user'] ?? null; + $this->pass = $url['pass'] ?? null; + $this->path = $url['path'] ?? null; - if(StringUtils::endsWith($this->path, '.php')) { + if (StringUtils::endsWith($this->path, '.php')) { $this->path = substr($this->path, 0, -4); } $this->path = strpos($this->path, $this->rootPath) === 0 ? substr($this->path, strlen($this->rootPath), strlen($this->path)) : $this->path; // TODO: this could cause a bug if the rootpath is the same as a regular path which is usually the language - $this->query = $url['query'] ?? null; - $this->queryString = $this->query; + $this->queryString = $url['query'] ?? null; - if (isset($this->query)) { - parse_str($this->query, $this->query); + if (isset($this->queryString)) { + parse_str($this->queryString, $this->query); } $this->fragment = $url['fragment'] ?? null; - $this->base = $this->scheme . '://' . $this->host . $this->rootPath; + $this->base = $this->scheme . '://' . $this->host . $this->rootPath; } /** @@ -275,7 +274,7 @@ class Http implements UriInterface */ public function getPathElement(int $pos) : string { - return explode('/', $this->path)[$pos]; + return explode('/', $this->path)[$pos]; } /**