mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-09-02 17:42:41 +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
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function updateCounterCache($keys = array(), $created = false) {
|
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();
|
$keys['old'] = isset($keys['old']) ? $keys['old'] : array();
|
||||||
|
|
||||||
foreach ($this->belongsTo as $parent => $assoc) {
|
foreach ($this->belongsTo as $parent => $assoc) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue