Description
Describe the bug
I have a website in Russian масла.сайт
. When setting up the Cloudflare addon I get the error “It looks like your domain is not set up on Cloudflare”. This happens because the $this->endpoints->get_zones( $zone_id );
function returns the domain name as масла.сайт
and the $parsed_url = wp_parse_url( $site_url );
function as xn--80aa6ac0a.xn--80aswg
.
To solve the problem, you need to use PHP's built-in idn_to_utf8()
function:
// Filename wp-content/plugins/wp-rocket/inc/Addon/Cloudflare/Cloudflare.php
if ( property_exists( $result, 'name' ) && false !== strpos( strtolower( idn_to_utf8( $parsed_url['host'] ) ), $result->name ) ) {
$zone_found = true;
}
To Reproduce
Steps to reproduce the behavior:
- Go to 'WP-Rocket Settings -> Addons -> Cloudflare'
- Fill in the 'Account email' and 'Zone ID' fields, and then click the 'Save Changes' button
- See error 'It looks like your domain is not set up on Cloudflare'