Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 22 additions & 9 deletions system/HTTP/SiteURI.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class SiteURI extends URI
* 0 => 'test',
* ];
*
* @var array
* @var array<int, string>
*
* @deprecated This property will be private.
*/
Expand Down Expand Up @@ -331,35 +331,48 @@ public function refreshPath()

/**
* Saves our parts from a parse_url() call.
*
* @param array{
* host?: string,
* user?: string,
* path?: string,
* query?: string,
* fragment?: string,
* scheme?: string,
* port?: int,
* pass?: string,
* } $parts
*/
protected function applyParts(array $parts): void
{
if (! empty($parts['host'])) {
if (isset($parts['host']) && $parts['host'] !== '') {
$this->host = $parts['host'];
}
if (! empty($parts['user'])) {

if (isset($parts['user']) && $parts['user'] !== '') {
$this->user = $parts['user'];
}

if (isset($parts['path']) && $parts['path'] !== '') {
$this->path = $this->filterPath($parts['path']);
}
if (! empty($parts['query'])) {

if (isset($parts['query']) && $parts['query'] !== '') {
$this->setQuery($parts['query']);
}
if (! empty($parts['fragment'])) {

if (isset($parts['fragment']) && $parts['fragment'] !== '') {
$this->fragment = $parts['fragment'];
}

// Scheme
if (isset($parts['scheme'])) {
$this->setScheme(rtrim($parts['scheme'], ':/'));
} else {
$this->setScheme('http');
}

// Port
if (isset($parts['port']) && $parts['port'] !== null) {
// Valid port numbers are enforced by earlier parse_url() or setPort()
if (isset($parts['port'])) {
// Valid port numbers are enforced by earlier parse_url or setPort()
$this->port = $parts['port'];
}

Expand Down
Loading
Loading