diff --git a/includes/class-ecwid-oauth.php b/includes/class-ecwid-oauth.php index 6914cdb5..99fbbdf4 100644 --- a/includes/class-ecwid-oauth.php +++ b/includes/class-ecwid-oauth.php @@ -396,9 +396,13 @@ public function check_url_for_idn_format( $url ) { if ( function_exists( 'idn_to_ascii' ) ) { $host = wp_parse_url( $url, PHP_URL_HOST ); - $is_idn_format = $host != idn_to_ascii( $host ); + if ( idn_to_ascii( $host, IDNA_DEFAULT, INTL_IDNA_VARIANT_UTS46 ) === false ) { + return $url; + } + + $is_idn_format = $host != idn_to_ascii( $host, IDNA_DEFAULT, INTL_IDNA_VARIANT_UTS46 ); if ( $is_idn_format ) { - $encoded_host = idn_to_ascii( $host ); + $encoded_host = idn_to_ascii( $host, IDNA_DEFAULT, INTL_IDNA_VARIANT_UTS46 ); $pattern = '/' . $host . '/i'; return preg_replace( $pattern, $encoded_host, $url, 1 );