summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRick Ellis <rick.ellis@ellislab.com>2008-09-09 22:42:33 +0200
committerRick Ellis <rick.ellis@ellislab.com>2008-09-09 22:42:33 +0200
commit9056b564b6c02e8e5246d94685e84d333641a009 (patch)
tree14695b62ebf3f8776ba384be13ba9cb1b1ac3ef8
parent80228e3ac50d804b67f6664ecbcd73dd58452bc5 (diff)
Allowed empty rules to be set, and fixed a bug that allows blank error messages to output the delimiters.
-rw-r--r--system/libraries/Form_validation.php11
1 files changed, 7 insertions, 4 deletions
diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php
index b658011bd..e8ba4e0df 100644
--- a/system/libraries/Form_validation.php
+++ b/system/libraries/Form_validation.php
@@ -96,8 +96,8 @@ class CI_Form_validation {
return;
}
- // No rules or fields? Nothing to do...
- if ( ! is_string($field) OR ! is_string($rules) OR $field == '' OR $rules == '')
+ // No fields? Nothing to do...
+ if ( ! is_string($field) OR ! is_string($rules) OR $field == '')
{
return;
}
@@ -197,7 +197,7 @@ class CI_Form_validation {
*/
function error($field = '', $prefix = '', $suffix = '')
{
- if ( ! isset($this->_field_data[$field]['error']))
+ if ( ! isset($this->_field_data[$field]['error']) OR $this->_field_data[$field]['error'] == '')
{
return '';
}
@@ -249,7 +249,10 @@ class CI_Form_validation {
$str = '';
foreach ($this->_error_array as $val)
{
- $str .= $prefix.$val.$suffix."\n";
+ if ($val != '')
+ {
+ $str .= $prefix.$val.$suffix."\n";
+ }
}
return $str;