From 7243d0b9019eec108255fae5b7eaf08a14a8092e Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sat, 12 Mar 2016 11:40:34 +0200 Subject: Fix #4516 --- system/libraries/Form_validation.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'system/libraries') diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php index 296ddb92a..09d6c9a97 100644 --- a/system/libraries/Form_validation.php +++ b/system/libraries/Form_validation.php @@ -583,7 +583,10 @@ class CI_Form_validation { protected function _execute($row, $rules, $postdata = NULL, $cycles = 0) { // If the $_POST data is an array we will run a recursive call - if (is_array($postdata)) + // + // Note: We MUST check if the array is empty or not! + // Otherwise empty arrays will always pass validation. + if (is_array($postdata) && ! empty($postdata)) { foreach ($postdata as $key => $val) { -- cgit v1.2.3-24-g4f1b