From ea4f739663df7bca5fa2de7ed495ba5facad2ca4 Mon Sep 17 00:00:00 2001 From: vetalt Date: Thu, 28 Nov 2013 02:33:00 +0200 Subject: [PATCH] fixed TEXT validator field_size is always zero for TEXT, but rule requires NULL in the case --- models/Profile.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/models/Profile.php b/models/Profile.php index 00b6719..7e0073a 100644 --- a/models/Profile.php +++ b/models/Profile.php @@ -55,6 +55,9 @@ public function rules() if ($field->field_type=='INTEGER') array_push($numerical,$field->varname); if ($field->field_type=='VARCHAR'||$field->field_type=='TEXT') { + if ($field->field_size == 0) { + $field->field_size = null; + } $field_rule = array($field->varname, 'length', 'max'=>$field->field_size, 'min' => $field->field_size_min); if ($field->error_message) $field_rule['message'] = UserModule::t($field->error_message); array_push($rules,$field_rule); @@ -191,4 +194,4 @@ public function afterSave() { } return parent::afterSave(); } -} \ No newline at end of file +}