Plugin Author
Chouby
(@chouby)
Hello,
WordPress uses these superglobals frequently. See https://github.com/WordPress/WordPress/search?q=request_uri and https://github.com/WordPress/WordPress/search?q=http_host. That’s the same for Polylang. You must ensure that they are populated to avoid these notices.
Note that for WP CLI, Polylang already works around the issue and doesn’t display any notice: https://github.com/polylang/polylang/blob/3.0.3/include/functions.php#L76-L83
I mean executing WordPress and PHP from the command line, not using the WP CLI package, which is another way to execute WP from the command line, but certainly not the only way. When executing WordPress and PHP from the command line, a HTTP_HOST and REQUEST_URI value is not possible as there is no HTTP connection and no HTTP request.
js.
Plugin Author
Chouby
(@chouby)
not possible
Haven’t you a wp-config file?
I perfectly understood that you are not using WP CLI. Otherwise Polylang would not display any warning.
As explained above, we cover WP CLI because we know it. We cannot cover other cases. The same way WP doesn’t cover them if it happens that some part of the code using these variables is executed while they are not defined. Maybe you haven’t any notice in WP, but as the search results I linked to in my previous answer demonstrate, that was pure luck. You must fill theses variables yourself to avoid notices in Polylang **and** WP.
The $_SERVER variable is provided by a web server, not WordPress or PHP. When using WordPress and PHP from the command line, a web server is not used, so those variables are not defined.
js.