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>
This commit is contained in:
tylerseymour 2011-04-13 16:38:54 -07:00 committed by mark_story
parent bc5edebee6
commit 13c64f1707

View file

@ -281,8 +281,14 @@ class CookieComponent extends Object {
$this->read();
}
if (strpos($key, '.') === false) {
unset($this->__values[$key]);
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]);
return;
}
$names = explode('.', $key, 2);