mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
Fixing Model::invalidFields to account for '0' in empty checks
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4935 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
d3c3d34dce
commit
fad2dc55ad
1 changed files with 1 additions and 1 deletions
|
@ -1710,7 +1710,7 @@ class Model extends Overloadable {
|
|||
), $validator);
|
||||
|
||||
if (empty($validator['on']) || ($validator['on'] == 'create' && !$this->exists()) || ($validator['on'] == 'update' && $this->exists())) {
|
||||
if ((!isset($data[$fieldName]) && $validator['required'] == true) || (isset($data[$fieldName]) && empty($data[$fieldName]) && $validator['allowEmpty'] == false)) {
|
||||
if ((!isset($data[$fieldName]) && $validator['required'] == true) || (isset($data[$fieldName]) && (empty($data[$fieldName]) && $data[$fieldName] != 0) && $validator['allowEmpty'] == false)) {
|
||||
$this->invalidate($fieldName, $validator['message']);
|
||||
} elseif (isset($data[$fieldName])) {
|
||||
if (is_array($validator['rule'])) {
|
||||
|
|
Loading…
Add table
Reference in a new issue