From da55e5c5608cfc7ea1703e7b9b0357dfe10c5ab7 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 22 Aug 2018 14:41:45 +0300 Subject: [ci skip] Add exceptions for 2 error cases in FV set_rules() --- system/libraries/Form_validation.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'system/libraries/Form_validation.php') 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; } -- cgit v1.2.3-24-g4f1b