summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--system/libraries/Validation.php12
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;
}
// --------------------------------------------------------------------