Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WordPress Plugins and Themes with Known Issues Doc Update #9424

Open
dficker opened this issue Feb 7, 2025 · 0 comments
Open

WordPress Plugins and Themes with Known Issues Doc Update #9424

dficker opened this issue Feb 7, 2025 · 0 comments
Assignees

Comments

@dficker
Copy link
Contributor

dficker commented Feb 7, 2025

Re: WordPress Plugins and Themes with Known Issues and SERVER_NAME and SERVER_PORT on Pantheon

Priority: Medium

Issue Description:

A few places have this line of code in our Docs as a workaround:

$_SERVER['SERVER_NAME'] = $_SERVER['HTTP_HOST'];

This solves some sort of issue for some plugins, but it also causes PHP Warnings when WP-CLI is executed. The "php-error.log" file will have errors like this one:

PHP Warning: Undefined array key "HTTP_HOST" in phar:///opt/pantheon/wpcli/wp-cli-2.11.0.phar/vendor/wp-cli/config-command/src/Config_Command.php(556) : eval()'d code on line 90

In a few recent cases, I think these PHP Warnings being present caused the Multisite Search-replace function of the platform to not work and error out. And I've seen a few other sites doing this and getting PHP Warnings as well.

Suggested Resolution

I think all these suggestions should be updated to this:

if (php_sapi_name() != 'cli') {
  $_SERVER['SERVER_NAME'] = $_SERVER['HTTP_HOST'];
}
@rachelwhitton rachelwhitton self-assigned this Feb 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants