diff options
author | Andrey Andreev <narf@devilix.net> | 2015-04-06 23:07:04 +0200 |
---|---|---|
committer | Andrey Andreev <narf@devilix.net> | 2015-04-06 23:07:04 +0200 |
commit | 475dfac090505832719cb6ff4ff13ab7ac655fbb (patch) | |
tree | b169c98f36e1928270ffa80c988a2a372806da22 /system | |
parent | 19311361d52413746327b590e3ef51e4d718fd82 (diff) |
Disallow empty FV rules ... for consistency
Related: #3736
Diffstat (limited to 'system')
-rw-r--r-- | system/libraries/Form_validation.php | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php index 05de59628..522eba704 100644 --- a/system/libraries/Form_validation.php +++ b/system/libraries/Form_validation.php @@ -198,22 +198,20 @@ class CI_Form_validation { return $this; } - // No fields? Nothing to do... - if ( ! is_string($field) OR $field === '') + // No fields or no rules? Nothing to do... + if ( ! is_string($field) OR $field === '' OR empty($rules)) { return $this; } elseif ( ! is_array($rules)) { // BC: Convert pipe-separated rules string to an array - if (is_string($rules)) - { - $rules = explode('|', $rules); - } - else + if ( ! is_string($rules)) { return $this; } + + $rules = explode('|', $rules); } // If the field label wasn't passed we use the field name |