[HttpFoundation] improve perf of previous merge (refs #8882)

This commit is contained in:
Fabien Potencier 2013-09-07 08:13:51 +02:00
parent 85eaec3eda
commit 729ac7b967

View File

@ -888,8 +888,8 @@ class Request
} }
if ($host = $this->headers->get('HOST')) { if ($host = $this->headers->get('HOST')) {
if (preg_match('/:(\d+)$/', $host, $matches)) { if (false !== $pos = strrpos($host, ':')) {
return intval($matches[1]); return intval(substr($host, $pos + 1));
} }
return 'https' === $this->getScheme() ? 443 : 80; return 'https' === $this->getScheme() ? 443 : 80;