From 27979286b272c9e5dfd4dd540ca4cb2674caaf31 Mon Sep 17 00:00:00 2001 From: ADmad Date: Sun, 15 Dec 2013 20:29:41 +0530 Subject: [PATCH] Revert change done in 11f543f1f2. The change is unneeded now as Security::encrypt() no longer throws exception for falsey values. --- lib/Cake/Controller/Component/CookieComponent.php | 2 +- .../Case/Controller/Component/CookieComponentTest.php | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/Cake/Controller/Component/CookieComponent.php b/lib/Cake/Controller/Component/CookieComponent.php index fd7db612422..d1aececd278 100644 --- a/lib/Cake/Controller/Component/CookieComponent.php +++ b/lib/Cake/Controller/Component/CookieComponent.php @@ -472,7 +472,7 @@ protected function _encrypt($value) { if (is_array($value)) { $value = $this->_implode($value); } - if (!$this->_encrypted || !$value) { + if (!$this->_encrypted) { return $value; } $prefix = "Q2FrZQ==."; diff --git a/lib/Cake/Test/Case/Controller/Component/CookieComponentTest.php b/lib/Cake/Test/Case/Controller/Component/CookieComponentTest.php index ae07a485fa8..f308a267b6b 100644 --- a/lib/Cake/Test/Case/Controller/Component/CookieComponentTest.php +++ b/lib/Cake/Test/Case/Controller/Component/CookieComponentTest.php @@ -202,11 +202,11 @@ public function testWriteSimple() { } /** - * 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 @@ public function testWriteWithNullEmptyString() { $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); } /**