I am using codeigniter framework for my site, but in form_validation I am getting error I followed this link in stackoverflow but it didn't work for me followed link: idn_to_ascii() in 5.2.17
Issue:
code in codeigniter libraries/form_validation.php:
public function valid_email($str)
{
if (function_exists('idn_to_ascii') && preg_match('#\A([^@]+)@(.+)\z#', $str, $matches))
{
$domain = defined('INTL_IDNA_VARIANT_UTS46')
? idn_to_ascii($matches[2], 0, INTL_IDNA_VARIANT_UTS46)
: idn_to_ascii($matches[2]);
if ($domain !== FALSE)
{
$str = $matches[1].'@'.$domain;
}
}
return (bool) filter_var($str, FILTER_VALIDATE_EMAIL);
}
1条答案
按热度按时间ygya80vv1#
理想的解决方案是upgrade ICU to its latest version
由于这在我的共享服务器上是不可能的,因此我解决了该问题,扩展了CI电子邮件库:
INTL_IDNA_VARIANT_UTS46
,不幸的是,我的服务器上没有安装该函数。INTL_IDNA_VARIANT_2003
,则会收到上面的已弃用错误消息。将此扩展类作为MY_email. php保存在您的application/libraries文件夹中。关于扩展原生库,前缀
MY_
是可配置的。