themexpert / onepager

Onepage Theme/Website Builder for WordPress
https://themesgrove.com/wp-onepager/
Other
304 stars 101 forks source link

Use home_url() instead of $_SERVER to get the host name in get_current_page_url() #145

Closed mt8 closed 5 years ago

mt8 commented 5 years ago

I saw the following error when starting up the editor.

Fatal error: Uncaught RuntimeException: Invalid host label, check its content in 
/var/www/html/wp-content/plugins/tx-onepager/vendor/league/url/src/Components/Host.php:164

It means that the verification of the host name failed.

ref: https://github.com/themexpert/onepager/blob/develop/src/functions.php#L73-L79

Depending on web server configuration, $_SERVER ['SERVER_NAME'] may return the following values:

*.example.com

In this case, the editor will not start and an error will be output.

I suggest using home_url() instead of $_SERVER['SERVER_NAME'] to get the current page URL in get_current_page_url().

Thanks.

codexpert commented 5 years ago

Issue fixed https://github.com/themexpert/onepager/commit/c6e22b109d1c2f5857fc0eb8a72390dff008ceca and tested on Shifter platform its working.

emaildano commented 5 years ago

Big shoutout to @mt8 for the PR 🍻

codexpert commented 5 years ago

Really appreciate @mt8 ❤️