diff options
author | Rick Ellis <rick.ellis@ellislab.com> | 2008-08-21 03:06:11 +0200 |
---|---|---|
committer | Rick Ellis <rick.ellis@ellislab.com> | 2008-08-21 03:06:11 +0200 |
commit | 719b65d54a85337c5616a781eff07d5031c106e9 (patch) | |
tree | c3dd0a03aee6143bbfc70c23f9a32a6a941ab59b /system/libraries/Validation.php | |
parent | 3deaa28a6e62054977daa4228fbe1429427ae990 (diff) |
Fixed a bug in is_natural_no_zero
Diffstat (limited to 'system/libraries/Validation.php')
-rw-r--r-- | system/libraries/Validation.php | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/system/libraries/Validation.php b/system/libraries/Validation.php index c828328b6..cae1a3f5a 100644 --- a/system/libraries/Validation.php +++ b/system/libraries/Validation.php @@ -640,7 +640,17 @@ class CI_Validation { */
function is_natural_no_zero($str)
{
- return (bool)preg_match( '/^[1-9]+$/', $str);
+ if ( ! preg_match( '/^[0-9]+$/', $str))
+ {
+ return FALSE;
+ }
+
+ if ($str == 0)
+ {
+ return FALSE;
+ }
+
+ return TRUE;
}
// --------------------------------------------------------------------
|