Fixed strict checking of 'required' attributes.

This commit is contained in:
Thomas Ploch 2012-02-07 15:31:27 +01:00
parent 4f3b266491
commit 07b16987a3

View file

@ -3016,14 +3016,14 @@ class Model extends Object implements CakeEventListener {
}
$validator = array_merge($default, $validator);
if (!empty($validator['on']) || in_array($validator['required'], array('create', 'update'))) {
if (!empty($validator['on']) || in_array($validator['required'], array('create', 'update'), true)) {
if ($exists === null) {
$exists = $this->exists();
}
if ($validator['on'] == 'create' && $exists || $validator['on'] == 'update' && !$exists) {
continue;
}
if ($validator['required'] == 'create' && !$exists || $validator['required'] == 'update' && $exists) {
if ($validator['required'] === 'create' && !$exists || $validator['required'] === 'update' && $exists) {
$validator['required'] = true;
}
}