소스 검색

[HttpFoundation] Allow the SERVER_PORT key of the server ParameterBag in Request to be a string value without confusing Request::getHttpHost().

The idea of a string port is probably semantically wrong, but it actually follows the convention of at least some web servers ($_SERVER['SERVER_PORT'] is actually a string). And since the $port variable is used as a string in getHttpHost(), it's correct to allow the types not to match.
Ryan Weaver 14 년 전
부모
커밋
58a240baba
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      src/Symfony/Component/HttpFoundation/Request.php

+ 2 - 2
src/Symfony/Component/HttpFoundation/Request.php

@@ -377,9 +377,9 @@ class Request
 
         $scheme = $this->getScheme();
         $name   = $this->server->get('SERVER_NAME');
-        $port   = $this->server->get('SERVER_PORT');
+        $port   = $this->getPort();
 
-        if (($scheme === 'http' && $port === 80) || ($scheme === 'https' && $port === 443)) {
+        if (($scheme == 'http' && $port == 80) || ($scheme == 'https' && $port == 443)) {
             return $name;
         } else {
             return $name.':'.$port;