From 38db78031c9f173385676aeb2716bed8fb0b0f0b Mon Sep 17 00:00:00 2001 From: meteor Date: Tue, 21 Nov 2023 20:10:37 +0400 Subject: [PATCH] PLUGINS-6451 --- includes/class-ecwid-oauth.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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 );