Skip to content

Commit

Permalink
PLUGINS-6451
Browse files Browse the repository at this point in the history
  • Loading branch information
meteor-ec committed Nov 21, 2023
1 parent f34a428 commit 38db780
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions includes/class-ecwid-oauth.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down

0 comments on commit 38db780

Please sign in to comment.