mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Check data with isset() before accessing it.
Don't blindly access data that may not exist. Fixes #2712
This commit is contained in:
parent
cf16ae055f
commit
d7d8fc00d1
1 changed files with 3 additions and 1 deletions
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue