Regression: base_url_absolute always has the port number (#1690)

This commit is contained in:
Matias Griese
2017-10-16 12:36:06 +03:00
parent 3856a2a719
commit a9c82710a6
2 changed files with 14 additions and 1 deletions

View File

@@ -2,7 +2,7 @@
## mm/dd/2017
1. [](#bugfix)
* Regression: `base_url_absolute` always has the port number (#1690)
# v1.3.6
## 10/12/2017

View File

@@ -79,6 +79,9 @@ class Uri
// Build port.
$this->port = isset($env['SERVER_PORT']) ? (int)$env['SERVER_PORT'] : null;
if ($this->hasStandardPort()) {
$this->port = null;
}
// Build path.
$request_uri = isset($env['REQUEST_URI']) ? $env['REQUEST_URI'] : '';
@@ -107,6 +110,16 @@ class Uri
$this->reset();
}
/**
* Does this Uri use a standard port?
*
* @return bool
*/
protected function hasStandardPort()
{
return ($this->scheme === 'http' && $this->port === 80) || ($this->scheme === 'https' && $this->port === 443);
}
/**
* @param string $url
*/