소스 검색

[HttpFoundation] removed the possibility for a cookie path to set it to null (as this is equivalent to /)

Fabien Potencier 13 년 전
부모
커밋
1e7e6ba305
2개의 변경된 파일6개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      src/Symfony/Component/HttpFoundation/Cookie.php
  2. 4 0
      src/Symfony/Component/HttpFoundation/ResponseHeaderBag.php

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

@@ -90,7 +90,7 @@ class Cookie
             }
         }
 
-        if (null !== $this->getPath()) {
+        if ('/' !== $this->getPath()) {
             $str .= '; path='.$this->getPath();
         }
 
@@ -166,7 +166,7 @@ class Cookie
      */
     public function getPath()
     {
-        return $this->path;
+        return null === $this->path ? '/' : $this->path;
     }
 
     /**

+ 4 - 0
src/Symfony/Component/HttpFoundation/ResponseHeaderBag.php

@@ -141,6 +141,10 @@ class ResponseHeaderBag extends HeaderBag
      */
     public function removeCookie($name, $path = '/', $domain = null)
     {
+        if (null === $path) {
+            $path = '/';
+        }
+
         unset($this->cookies[$domain][$path][$name]);
 
         if (empty($this->cookies[$domain][$path])) {