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:
nate 2007-04-30 06:26:59 +00:00
parent d3c3d34dce
commit fad2dc55ad

View file

@ -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'])) {