Skip to content
Closed
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions includes/class-amp-http.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,11 @@ public static function get_amp_cache_hosts() {
if ( function_exists( 'idn_to_utf8' ) ) {
if ( version_compare( PHP_VERSION, '5.4', '>=' ) && defined( 'INTL_IDNA_VARIANT_UTS46' ) ) {
$domain = idn_to_utf8( $domain, IDNA_DEFAULT, INTL_IDNA_VARIANT_UTS46 ); // phpcs:ignore PHPCompatibility.FunctionUse.NewFunctionParameters.idn_to_utf8_variantFound, PHPCompatibility.Constants.NewConstants.intl_idna_variant_uts46Found
} elseif ( version_compare( PHP_VERSION, '7.2', '==' ) || version_compare( PHP_VERSION, '7.3', '==' ) ) {
/* In PHP 7.2/7.3 calling idn_to_* functions with default arguments throws a warning. Thus we must set the variant explicitely. This may be reverted when php 7.4 is commonly used and idn_to_utf8 can be used in its default mode without warnings. */
$variant = INTL_IDNA_VARIANT_UTS46;
$options = IDNA_DEFAULT;
$domain = idn_to_utf8( $domain, $options, $variant );
} else {
$domain = idn_to_utf8( $domain );
}
Expand Down