Skip to content
Browse files

Fix issue where values are not recursively deleted. ie:

$this->Cookie->write('User.email', 'test@example.com');
$this->Cookie->delete('User');
The cookie for User.email would not be removed (despite being removed from the __values array.
Fixes #1651

Signed-off-by: mark_story <mark@mark-story.com>
  • Loading branch information...
1 parent bc5edeb commit 13c64f170796918e44d991c8eb01e0c769e9b5de @tylerseymour tylerseymour committed with markstory Apr 13, 2011
Showing with 7 additions and 1 deletion.
  1. +7 −1 cake/libs/controller/components/cookie.php
View
8 cake/libs/controller/components/cookie.php
@@ -281,8 +281,14 @@ function delete($key) {
$this->read();
}
if (strpos($key, '.') === false) {
+ if(isset($this->__values[$key]) && is_array($this->__values[$key])) {
+ foreach($this->__values[$key] as $idx => $val) {
+ $this->__delete("[$key][$idx]");
+ }
+ } else {
+ $this->__delete("[$key]");
+ }
unset($this->__values[$key]);
- $this->__delete("[$key]");
return;
}
$names = explode('.', $key, 2);

0 comments on commit 13c64f1

Please sign in to comment.
Something went wrong with that request. Please try again.