Sfoglia il codice sorgente

fixes a bug where the cookie was wrongly considered expired

Johannes Schmitt 14 anni fa
parent
commit
eb85cc550b

+ 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());
     }
 }