From 719b65d54a85337c5616a781eff07d5031c106e9 Mon Sep 17 00:00:00 2001 From: Rick Ellis Date: Thu, 21 Aug 2008 01:06:11 +0000 Subject: Fixed a bug in is_natural_no_zero --- system/libraries/Validation.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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; } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b