Add support for non-ASCII domain names in FV & Email classes' valid_email()
Depends on the Intl extension
diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php
index dc5d17f..555a659 100644
--- a/system/libraries/Form_validation.php
+++ b/system/libraries/Form_validation.php
@@ -1225,6 +1225,11 @@
*/
public function valid_email($str)
{
+ if (function_exists('idn_to_ascii') && $atpos = strpos($email, '@'))
+ {
+ $email = substr($email, 0, ++$atpos).idn_to_ascii(substr($email, $atpos));
+ }
+
return (bool) filter_var($str, FILTER_VALIDATE_EMAIL);
}