From 90803ce9d3f9343c5f2ea37cc53a390e9c2ee8c8 Mon Sep 17 00:00:00 2001 From: Hashem Qolami Date: Sun, 21 Jul 2013 22:47:55 +0430 Subject: Fix Form Validation issue with text inputs which have array as name Signed-off-by: Hashem Qolami --- system/libraries/Form_validation.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/libraries') diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php index 40ba01202..47c9dcaa3 100644 --- a/system/libraries/Form_validation.php +++ b/system/libraries/Form_validation.php @@ -583,7 +583,7 @@ class CI_Form_validation { // If the field is blank, but NOT required, no further tests are necessary $callback = FALSE; - if ( ! in_array('required', $rules) && $postdata === NULL) + if ( ! in_array('required', $rules) && ($postdata === NULL OR empty($postdata))) { // Before we bail out, does the rule contain a callback? if (preg_match('/(callback_\w+(\[.*?\])?)/', implode(' ', $rules), $match)) @@ -598,7 +598,7 @@ class CI_Form_validation { } // Isset Test. Typically this rule will only apply to checkboxes. - if ($postdata === NULL && $callback === FALSE) + if (($postdata === NULL OR empty($postdata)) && $callback === FALSE) { if (in_array('isset', $rules, TRUE) OR in_array('required', $rules)) { -- cgit v1.2.3-24-g4f1b