From 1f0c9736819b8bb879641bb6cbaaf5ddc826c7e4 Mon Sep 17 00:00:00 2001 From: Wouter Date: Fri, 9 Mar 2018 16:51:08 +0100 Subject: [PATCH] Don't break on removing a non-existing rule --- lib/Cake/Model/ModelValidator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Cake/Model/ModelValidator.php b/lib/Cake/Model/ModelValidator.php index f968e2cff..c84e58f75 100644 --- a/lib/Cake/Model/ModelValidator.php +++ b/lib/Cake/Model/ModelValidator.php @@ -594,7 +594,7 @@ class ModelValidator implements ArrayAccess, IteratorAggregate, Countable { $this->_parseRules(); if ($rule === null) { unset($this->_fields[$field]); - } else { + } elseif (array_key_exists($field, $this->_fields)) { $this->_fields[$field]->removeRule($rule); } return $this;