From 13c64f170796918e44d991c8eb01e0c769e9b5de Mon Sep 17 00:00:00 2001 From: tylerseymour Date: Wed, 13 Apr 2011 16:38:54 -0700 Subject: [PATCH] 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 --- cake/libs/controller/components/cookie.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cake/libs/controller/components/cookie.php b/cake/libs/controller/components/cookie.php index e3a122ca5..bfd270185 100644 --- a/cake/libs/controller/components/cookie.php +++ b/cake/libs/controller/components/cookie.php @@ -281,8 +281,14 @@ class CookieComponent extends Object { $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);