From 3f9e557ed1e5b9d0ea14bba201058b3877a96da8 Mon Sep 17 00:00:00 2001 From: Derek Allard Date: Tue, 16 Oct 2007 13:10:02 +0000 Subject: Changed the behaviour of custom callbacks so that they no longer trigger the "required" rule. --- system/libraries/Validation.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/libraries/Validation.php') diff --git a/system/libraries/Validation.php b/system/libraries/Validation.php index 33753bc72..575c5262e 100644 --- a/system/libraries/Validation.php +++ b/system/libraries/Validation.php @@ -195,7 +195,7 @@ class CI_Validation { $ex = explode('|', $rules); // Is the field required? If not, if the field is blank we'll move on to the next test - if ( ! in_array('required', $ex, TRUE) AND strpos($rules, 'callback_') === FALSE) + if ( ! in_array('required', $ex, TRUE)) { if ( ! isset($_POST[$field]) OR $_POST[$field] == '') { @@ -546,7 +546,7 @@ class CI_Validation { */ function numeric($str) { - return ( ! ereg("^[0-9\.]+$", $str)) ? FALSE : TRUE; + return ! preg_match('/[^0-9]/', $str); } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b