Browse Source

Merge pull request #2484 from ADmad/2.5-cookiecomponent

Revert change done in 11f543f1f2.
José Lorenzo Rodríguez 12 years ago
parent
commit
b5d7628cbf

+ 1 - 1
lib/Cake/Controller/Component/CookieComponent.php

@@ -472,7 +472,7 @@ class CookieComponent extends Component {
 		if (is_array($value)) {
 			$value = $this->_implode($value);
 		}
-		if (!$this->_encrypted || !$value) {
+		if (!$this->_encrypted) {
 			return $value;
 		}
 		$prefix = "Q2FrZQ==.";

+ 7 - 3
lib/Cake/Test/Case/Controller/Component/CookieComponentTest.php

@@ -202,11 +202,11 @@ class CookieComponentTest extends CakeTestCase {
 	}
 
 /**
- * test write() Encrypted data with null & empty string & boolean value 
+ * test write() encrypted data with falsey value
  *
  * @return void
  */
-	public function testWriteWithNullEmptyString() {
+	public function testWriteWithFalseyValue() {
 		$this->Cookie->type('aes');
 		$this->Cookie->key = 'qSI232qs*&sXOw!adre@34SAv!@*(XSL#$%)asGb$@11~_+!@#HKis~#^';
 
@@ -228,7 +228,11 @@ class CookieComponentTest extends CakeTestCase {
 
 		$this->Cookie->write('Testing', '0');
 		$result = $this->Cookie->read('Testing');
-		$this->assertEquals('0', $result);
+		$this->assertSame('0', $result);
+
+		$this->Cookie->write('Testing', 0);
+		$result = $this->Cookie->read('Testing');
+		$this->assertSame(0, $result);
 	}
 
 /**