From 580388bc79e340ddf44f52853524ecc03b9d339c Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 27 Jun 2012 15:43:46 +0300 Subject: valid_email() to always return boolean --- system/helpers/email_helper.php | 2 +- system/libraries/Email.php | 2 +- system/libraries/Form_validation.php | 2 +- user_guide_src/source/changelog.rst | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/system/helpers/email_helper.php b/system/helpers/email_helper.php index 628667d4d..2a63b36c9 100644 --- a/system/helpers/email_helper.php +++ b/system/helpers/email_helper.php @@ -47,7 +47,7 @@ if ( ! function_exists('valid_email')) */ function valid_email($email) { - return filter_var($email, FILTER_VALIDATE_EMAIL); + return (bool) filter_var($email, FILTER_VALIDATE_EMAIL); } } diff --git a/system/libraries/Email.php b/system/libraries/Email.php index 0fcdbd83e..fdb9be4da 100644 --- a/system/libraries/Email.php +++ b/system/libraries/Email.php @@ -708,7 +708,7 @@ class CI_Email { */ public function valid_email($email) { - return filter_var($email, FILTER_VALIDATE_EMAIL); + return (bool) filter_var($email, FILTER_VALIDATE_EMAIL); } // -------------------------------------------------------------------- diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php index f3087f883..353624100 100644 --- a/system/libraries/Form_validation.php +++ b/system/libraries/Form_validation.php @@ -1076,7 +1076,7 @@ class CI_Form_validation { */ public function valid_email($str) { - return filter_var($str, FILTER_VALIDATE_EMAIL); + return (bool) filter_var($str, FILTER_VALIDATE_EMAIL); } // -------------------------------------------------------------------- diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index cc6220253..70d0c80a9 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -48,6 +48,7 @@ Release Date: Not Released - Global config files are loaded first, then environment ones. Environment config keys overwrite base ones, allowing to only set the keys we want changed per environment. - Changed detection of ``$view_folder`` so that if it's not found in the current path, it will now also be searched for under the application folder. - Path constants BASEPATH, APPPATH and VIEWPATH are now (internally) defined as absolute paths. + - Updated email validation methods to use filter_var() instead of PCRE. - Helpers @@ -73,7 +74,6 @@ Release Date: Not Released - ``read_file()`` is now a deprecated alias of ``file_get_contents()``. - Added an optional parameter to :doc:`Date Helper ` function ``timezone_menu()`` that allows more attributes to be added to the generated select tag. - :doc:`Security Helper ` function ``strip_image_tags()`` is now an alias for the same method in the :doc:`Security Library `. - - Updated email validation methods to use filter_var so they are more accurate. - Database -- cgit v1.2.3-24-g4f1b