소스 검색

[BrowserKit] Fixed cookie expiry discard when attribute contains capitals

Chris Smith 13 년 전
부모
커밋
00cbd39813
2개의 변경된 파일6개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      src/Symfony/Component/BrowserKit/Cookie.php
  2. 5 0
      tests/Symfony/Tests/Component/BrowserKit/CookieTest.php

+ 1 - 1
src/Symfony/Component/BrowserKit/Cookie.php

@@ -169,7 +169,7 @@ class Cookie
             }
 
             if (2 === count($elements = explode('=', $part, 2))) {
-                if ('expires' === $elements[0]) {
+                if ('expires' === strtolower($elements[0])) {
                     $elements[1] = self::parseDate($elements[1]);
                 }
 

+ 5 - 0
tests/Symfony/Tests/Component/BrowserKit/CookieTest.php

@@ -61,6 +61,11 @@ class CookieTest extends \PHPUnit_Framework_TestCase
         );
     }
 
+    public function testFromStringWithCapitalization()
+    {
+        $this->assertEquals('foo=bar; expires=Fri, 31 Dec 2010 23:59:59 GMT', (string) Cookie::fromString('foo=bar; Expires=Fri, 31 Dec 2010 23:59:59 GMT'));
+    }
+
     public function testFromStringWithUrl()
     {
         $this->assertEquals('foo=bar; domain=www.example.com', (string) Cookie::FromString('foo=bar', 'http://www.example.com/'));