diff options
author | Derek Jones <derek.jones@ellislab.com> | 2008-01-17 00:59:30 +0100 |
---|---|---|
committer | Derek Jones <derek.jones@ellislab.com> | 2008-01-17 00:59:30 +0100 |
commit | fbe122d0c029f254019d6ebb53c9b85706d0a1a1 (patch) | |
tree | ace7430ef9b201f9906d8fa2aca1ff222ed452c4 | |
parent | 7226bb9036833a5619014f7c64f036cdc281e5cd (diff) |
added some extra protection in ctype_ function overrides to make return values match PHP's native methods for non-string types and empty strings
-rw-r--r-- | system/codeigniter/Compat.php | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/system/codeigniter/Compat.php b/system/codeigniter/Compat.php index 3c5f70d60..108b0a1aa 100644 --- a/system/codeigniter/Compat.php +++ b/system/codeigniter/Compat.php @@ -55,6 +55,11 @@ if (! function_exists('ctype_digit')) { function ctype_digit($str) { + if (! is_string($str) OR $str == '') + { + return FALSE; + } + return ! preg_match('/[^0-9]/', $str); } } @@ -75,6 +80,11 @@ if (! function_exists('ctype_alnum')) { function ctype_alnum($str) { + if (! is_string($str) OR $str == '') + { + return FALSE; + } + return ! preg_match('/[^0-9a-z]/i', $str); } } |