going to change ZF2.4.9 core

I decided to change ZF 2.4.9 core. I know its a wired decision. But I don’t have any choice, cause they didn’t provide any release for PHP 7x. But the change will noted in this site by adding post for future.

Today I’m changing –

class: Zend\Validator\EmailAddress
function: idnToAscii($email) and
function: idnToUtf8($email)

Previous (original) code –

protected function idnToAscii($email)
{
if (extension_loaded(‘intl’)) {
return (idn_to_ascii($email) ?: $email);
}
return $email;
}

protected function idnToUtf8($email)
{
if (extension_loaded(‘intl’)) {
return idn_to_utf8($email);
}
return $email;
}

New Code

protected function idnToAscii($email)
{
if (extension_loaded(‘intl’)) {
return (idn_to_ascii($email, IDNA_DEFAULT, INTL_IDNA_VARIANT_UTS46) ?: $email);
}
return $email;
}

protected function idnToUtf8($email)
{
if (extension_loaded(‘intl’)) {
return idn_to_utf8($email, IDNA_DEFAULT, INTL_IDNA_VARIANT_UTS46);
}
return $email;
}

I took this decision for –

https://bugs.php.net/bug.php?id=75609 and
https://wiki.php.net/rfc/deprecate-and-remove-intl_idna_variant_2003

 

Posted in php, zf2Tagged , , ,