summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--system/libraries/Form_validation.php18
1 files changed, 14 insertions, 4 deletions
diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php
index fe7502773..6ef11e345 100644
--- a/system/libraries/Form_validation.php
+++ b/system/libraries/Form_validation.php
@@ -479,19 +479,29 @@ class CI_Form_validation {
return;
}
-
+
// --------------------------------------------------------------------
// If the field is blank, but NOT required, no further tests are necessary
- if ( ! in_array('required', $rules, TRUE) AND is_null($postdata))
+ $callback = FALSE;
+ if ( ! in_array('required', $rules) AND is_null($postdata))
{
- return;
+ // Before we bail out, does the rule contain a callback?
+ if (preg_match("/(callback_\w+)/", implode(' ', $rules), $match))
+ {
+ $callback = TRUE;
+ $rules = (array('1' => $match[1]));
+ }
+ else
+ {
+ return;
+ }
}
// --------------------------------------------------------------------
// Isset Test. Typically this rule will only apply to checkboxes.
- if (is_null($postdata))
+ if (is_null($postdata) AND $callback == FALSE)
{
if (in_array('isset', $rules, TRUE) OR in_array('required', $rules))
{