Skip to content

Commit

Permalink
Revert change done in 11f543f.
Browse files Browse the repository at this point in the history
The change is unneeded now as Security::encrypt() no longer throws exception
for falsey values.
  • Loading branch information
ADmad committed Dec 15, 2013
1 parent bba3e78 commit 2797928
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/Cake/Controller/Component/CookieComponent.php
Expand Up @@ -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==.";
Expand Down
10 changes: 7 additions & 3 deletions lib/Cake/Test/Case/Controller/Component/CookieComponentTest.php
Expand Up @@ -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~#^';

Expand All @@ -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);
}

/**
Expand Down

0 comments on commit 2797928

Please sign in to comment.