mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
Fixed strict checking of 'required' attributes.
This commit is contained in:
parent
4f3b266491
commit
07b16987a3
1 changed files with 2 additions and 2 deletions
|
@ -3016,14 +3016,14 @@ class Model extends Object implements CakeEventListener {
|
||||||
}
|
}
|
||||||
$validator = array_merge($default, $validator);
|
$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) {
|
if ($exists === null) {
|
||||||
$exists = $this->exists();
|
$exists = $this->exists();
|
||||||
}
|
}
|
||||||
if ($validator['on'] == 'create' && $exists || $validator['on'] == 'update' && !$exists) {
|
if ($validator['on'] == 'create' && $exists || $validator['on'] == 'update' && !$exists) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ($validator['required'] == 'create' && !$exists || $validator['required'] == 'update' && $exists) {
|
if ($validator['required'] === 'create' && !$exists || $validator['required'] === 'update' && $exists) {
|
||||||
$validator['required'] = true;
|
$validator['required'] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue