Skip to content

Commit

Permalink
Fix issue where values are not recursively deleted. ie:
Browse files Browse the repository at this point in the history
$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
tylerseymour authored and markstory committed Apr 16, 2011
1 parent bc5edeb commit 13c64f1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cake/libs/controller/components/cookie.php
Expand Up @@ -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);
Expand Down

0 comments on commit 13c64f1

Please sign in to comment.