Deprecation: #87894 - GeneralUtility::idnaEncode¶
See forge#87894
Description¶
PHP has the native function idn_to_ascii($domain, IDNA_DEFAULT, INTL_IDNA_VARIANT_UTS46)
for converting UTF-8 based domains to ascii-based ("punicode")
which is available in all supported PHP versions using "symfony/polyfill-intl-idn"
.
For this reason the method GeneralUtility::idnaEncode()
has been marked as deprecated.
Impact¶
Calling GeneralUtility::idnaEncode()
directly will trigger a PHP E_USER_DEPRECATED
error.
Affected Installations¶
Any TYPO3 installation with third-party extensions calling this method.
Migration¶
Use idn_to_ascii($domain, IDNA_DEFAULT, INTL_IDNA_VARIANT_UTS46);
instead.
Please be aware that contrary to GeneralUtility::idnaEncode()
the native PHP function only works on domain names, not email addresses or
similar. In order to encode email addresses split the address at the last '@'
and use idn_to_ascii()
on that last part.
Also, if there is an error in converting a string, a bool false
is returned.