소스 검색

fixes a bug where the cookie was wrongly considered expired

Johannes Schmitt 14 년 전
부모
커밋
eb85cc550b
2개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      src/Symfony/Component/BrowserKit/Cookie.php
  2. 3 0
      tests/Symfony/Tests/Component/BrowserKit/CookieTest.php

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

@@ -282,6 +282,6 @@ class Cookie
      */
     public function isExpired()
     {
-        return (null !== $this->expires) && $this->expires < time();
+        return null !== $this->expires && 0 !== $this->expires && $this->expires < time();
     }
 }

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

@@ -136,5 +136,8 @@ class CookieTest extends \PHPUnit_Framework_TestCase
 
         $cookie = new Cookie('foo', 'bar', time() - 86400);
         $this->assertTrue($cookie->isExpired(), '->isExpired() returns true when the cookie is expired');
+
+        $cookie = new Cookie('foo', 'bar', 0);
+        $this->assertFalse($cookie->isExpired());
     }
 }