diff options
author | Andrey Andreev <narf@devilix.net> | 2018-08-22 13:41:45 +0200 |
---|---|---|
committer | Andrey Andreev <narf@devilix.net> | 2018-08-22 13:41:45 +0200 |
commit | da55e5c5608cfc7ea1703e7b9b0357dfe10c5ab7 (patch) | |
tree | 5b4a7ce7e268ad9cab7f5eb159cde4f6bc93b45d | |
parent | 7269d8376151afe58dc23956693bf12ec48bc45d (diff) |
[ci skip] Add exceptions for 2 error cases in FV set_rules()
-rw-r--r-- | system/libraries/Form_validation.php | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php index bea51648e..35c984b72 100644 --- a/system/libraries/Form_validation.php +++ b/system/libraries/Form_validation.php @@ -198,13 +198,14 @@ class CI_Form_validation { // No fields or no rules? Nothing to do... if ( ! is_string($field) OR $field === '' OR empty($rules)) { - return $this; + throw new RuntimeException('Form_validation: set_rules() called with an empty $rules parameter'); } elseif ( ! is_array($rules)) { // BC: Convert pipe-separated rules string to an array if ( ! is_string($rules)) { + throw new InvalidArgumentException('Form_validation: set_rules() expect $rules to be string or array; '.gettype($rules).' given'); return $this; } |