From d7d8fc00d1834b2ec00ecca16c23d6913f8b8c4c Mon Sep 17 00:00:00 2001 From: mark_story Date: Sat, 25 Jan 2014 22:15:47 -0500 Subject: [PATCH] Check data with isset() before accessing it. Don't blindly access data that may not exist. Fixes #2712 --- lib/Cake/Model/Model.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/Cake/Model/Model.php b/lib/Cake/Model/Model.php index 970b63b12..3cc81c304 100644 --- a/lib/Cake/Model/Model.php +++ b/lib/Cake/Model/Model.php @@ -2026,7 +2026,9 @@ class Model extends Object implements CakeEventListener { * @return void */ public function updateCounterCache($keys = array(), $created = false) { - $keys = empty($keys) ? $this->data[$this->alias] : $keys; + if (empty($keys) && isset($this->data[$this->alias])) { + $keys = $this->data[$this->alias]; + } $keys['old'] = isset($keys['old']) ? $keys['old'] : array(); foreach ($this->belongsTo as $parent => $assoc) {