Jump to content

Edit History

MrGubu

MrGubu


mention author

On 12/6/2020 at 12:02 PM, Tomas Brincil said:

According to available information the upgrade to 7.4 should work but my webohosting does not support at the moment.

I found a solution for PHP 7.3:

There is a problem with constant INTL_IDNA_VARIANT_UTS46 in the file "src/Core/Util/InternationalizedDomainNameConverter.php". It needs to be modified as follows. The constant INTL_IDNA_VARIANT_UTS46 needs to be converted to int type explicitelly by intval() on the line 47.


class InternationalizedDomainNameConverter
{
    /**
     * Convert the host part of the email from punycode to utf8 (e.g,. [email protected] -> email@тест.рф)
     *
     * @param string $email
     *
     * @return string
     */
    public function emailToUtf8(string $email): string
    {
        $parts = explode('@', $email);
        if (count($parts) !== 2) {
            return $email;
        }

        return $parts[0] . '@' . idn_to_utf8($parts[1], 0, intval(INTL_IDNA_VARIANT_UTS46));
    }
}

 

Eureka! It works for me with PHP 7.3.25.
Excelent first post Tomas!! ;)

 

MrGubu

MrGubu

On 12/6/2020 at 12:02 PM, Tomas Brincil said:

According to available information the upgrade to 7.4 should work but my webohosting does not support at the moment.

I found a solution for PHP 7.3:

There is a problem with constant INTL_IDNA_VARIANT_UTS46 in the file "src/Core/Util/InternationalizedDomainNameConverter.php". It needs to be modified as follows. The constant INTL_IDNA_VARIANT_UTS46 needs to be converted to int type explicitelly by intval() on the line 47.


class InternationalizedDomainNameConverter
{
    /**
     * Convert the host part of the email from punycode to utf8 (e.g,. [email protected] -> email@тест.рф)
     *
     * @param string $email
     *
     * @return string
     */
    public function emailToUtf8(string $email): string
    {
        $parts = explode('@', $email);
        if (count($parts) !== 2) {
            return $email;
        }

        return $parts[0] . '@' . idn_to_utf8($parts[1], 0, intval(INTL_IDNA_VARIANT_UTS46));
    }
}

 

Eureka! It works for me with PHP 7.3.25.
Excelent first post!! ;)

 

×
×
  • Create New...