Skip to content

Commit 13c64f1

Browse files
tylerseymourmarkstory
authored andcommitted
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>
1 parent bc5edeb commit 13c64f1

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

cake/libs/controller/components/cookie.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,8 +281,14 @@ function delete($key) {
281281
$this->read();
282282
}
283283
if (strpos($key, '.') === false) {
284+
if(isset($this->__values[$key]) && is_array($this->__values[$key])) {
285+
foreach($this->__values[$key] as $idx => $val) {
286+
$this->__delete("[$key][$idx]");
287+
}
288+
} else {
289+
$this->__delete("[$key]");
290+
}
284291
unset($this->__values[$key]);
285-
$this->__delete("[$key]");
286292
return;
287293
}
288294
$names = explode('.', $key, 2);

0 commit comments

Comments
 (0)