Skip to content

WordPress Plugins and Themes with Known Issues Doc Update #9424

Closed
@dficker

Description

@dficker

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'];
}

Metadata

Metadata

Assignees

Labels

Type: Quick FixIssues that should be resolvable in a small PR

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions