When working from a localhost:XXXX (eg. localhost:9000) domain, the port number is not stripped when parsing HTTP_HOST, causing setcookie to fail. This renders theme switching completely unusable.
The issue is in inc/plugin-core.php on line 43:
$domain = sanitize_text_field($_SERVER['HTTP_HOST']);
Using parse_url fixes the issue:
$domain = parse_url(sanitize_text_field($_SERVER['HTTP_HOST']), PHP_URL_HOST);
Is it possible to submit a pull request for this?
- The topic ‘Cookie creation fails for localhost:XXXX hosts’ is closed to new replies.