diff options
author | Derek Allard <derek.allard@ellislab.com> | 2007-10-16 15:10:02 +0200 |
---|---|---|
committer | Derek Allard <derek.allard@ellislab.com> | 2007-10-16 15:10:02 +0200 |
commit | 3f9e557ed1e5b9d0ea14bba201058b3877a96da8 (patch) | |
tree | bf1b824d2f7623c473e6af173a34ebfa1fb67710 | |
parent | db43858f537722deef7c9ebc903534ea9be0df60 (diff) |
Changed the behaviour of custom callbacks so that they no longer trigger the "required" rule.
-rw-r--r-- | system/libraries/Validation.php | 4 | ||||
-rw-r--r-- | user_guide/changelog.html | 3 |
2 files changed, 4 insertions, 3 deletions
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);
}
// --------------------------------------------------------------------
diff --git a/user_guide/changelog.html b/user_guide/changelog.html index d9819d4f3..69e461421 100644 --- a/user_guide/changelog.html +++ b/user_guide/changelog.html @@ -76,7 +76,8 @@ Change Log <li>Added a check for NULL fields in the MySQL database backup utility.</li>
<li>Documented the timezones() function in the <a href="./helpers/date_helper.html">Date Helper</a>.</li>
<li>Documented unset_userdata in the <a href="./libraries/sessions.html">Session class</a>.</li>
- <li>Fixed a bug in <a href="./libraries/validation.html">Validation</a> where valid_ip() wasn't called properly</li>
+ <li>Changed the behaviour of custom callbacks so that they no longer trigger the "required" rule. </li>
+ <li>Fixed a bug in <a href="./libraries/validation.html">Validation</a> where valid_ip() wasn't called properly.</li>
<li>Fixed a bug in the Session library where user agent matching would fail on user agents ending with a space. </li>
<li>Fixed a bug in database driver where num_rows property wasn't getting updated.</li>
<li>Fixed a bug in captcha calling an invalid PHP function.</li>
|