diff options
author | Timothy Warren <tim@timshomepage.net> | 2012-06-27 14:06:06 +0200 |
---|---|---|
committer | Timothy Warren <tim@timshomepage.net> | 2012-06-27 14:06:06 +0200 |
commit | 384b34217b3709d3b3f11dbda3ac5c53274ff117 (patch) | |
tree | 72c5aaa6a144aeca49feb1a3b00d6e9b314d1ef7 | |
parent | 13077951b63cf9858dc14ec9cab7f2b53ec88a3e (diff) |
Update other email validation methods
-rw-r--r-- | system/libraries/Email.php | 2 | ||||
-rw-r--r-- | system/libraries/Form_validation.php | 2 | ||||
-rw-r--r-- | user_guide_src/source/changelog.rst | 1 |
3 files changed, 3 insertions, 2 deletions
diff --git a/system/libraries/Email.php b/system/libraries/Email.php index dd5477e05..5e6f69842 100644 --- a/system/libraries/Email.php +++ b/system/libraries/Email.php @@ -708,7 +708,7 @@ class CI_Email { */ public function valid_email($address) { - return (bool) preg_match('/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix', $address); + return filter_var($email, FILTER_VALIDATE_EMAIL); } // -------------------------------------------------------------------- diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php index 8e03e91f3..9ef58724c 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 (bool) preg_match('/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix', $str); + return filter_var($email, FILTER_VALIDATE_EMAIL); } // -------------------------------------------------------------------- diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index c0fa9d7f7..cc6220253 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -73,6 +73,7 @@ Release Date: Not Released - ``read_file()`` is now a deprecated alias of ``file_get_contents()``. - Added an optional parameter to :doc:`Date Helper <helpers/date_helper>` function ``timezone_menu()`` that allows more attributes to be added to the generated select tag. - :doc:`Security Helper <helpers/security_helper>` function ``strip_image_tags()`` is now an alias for the same method in the :doc:`Security Library <libraries/security>`. + - Updated email validation methods to use filter_var so they are more accurate. - Database |