summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2015-06-11 16:44:20 +0200
committerAndrey Andreev <narf@devilix.net>2015-06-11 16:44:20 +0200
commit29de16588458b1abc1b2fb4d125bd9fe04e755c6 (patch)
tree927e8ad5fff537629a765de6d8f1216a4a99333d
parent38b5eb0cccd06c1819c5c69fc967ce802b39835a (diff)
Fix #3904
-rw-r--r--system/libraries/Form_validation.php6
-rw-r--r--user_guide_src/source/changelog.rst1
2 files changed, 7 insertions, 0 deletions
diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php
index 36a8148df..0251286ea 100644
--- a/system/libraries/Form_validation.php
+++ b/system/libraries/Form_validation.php
@@ -618,6 +618,12 @@ class CI_Form_validation {
$rules = array(1 => $rule);
break;
}
+ elseif (is_array($rule) && isset($rule[0], $rule[1]) && is_callable($rule[1]))
+ {
+ $callback = TRUE;
+ $rules = array($rule[0] => $rule[1]);
+ break;
+ }
}
if ( ! $callback)
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index 3a6db3daf..1d9fa0b64 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -32,6 +32,7 @@ Bug fixes for 3.0.1
- Fixed a bug in the :doc:`Database Utility Class <database/utilities>` method ``csv_from_result()`` didn't work with a whitespace CSV delimiter.
- Fixed a bug (#3890) - :doc:`Input Library <libraries/input>` method ``get_request_header()`` treated header names as case-sensitive.
- Fixed a bug (#3903) - :doc:`Form Validation Library <libraries/form_validation>` ignored "unnamed" closure validation rules.
+- Fixed a bug (#3904) - :doc:`Form Validation Library <libraries/form_validation>` ignored "named" callback rules when the field is empty and there's no 'required' rule.
Version 3.0.0
=============