Open heyjones opened 2 years ago
I’m assuming there’s a better default for this than null
but I’m not that familiar with the rest of the code.
@rinatkhaziev could you please take a look as well?
@heyjones could you please provide steps to reproduce the issue? I'm not able to trigger the behavior you describe on a regular request.
@rinatkhaziev here are the constants in my wp-config.php
:
define( 'DB_NAME', 'local' );
define( 'DB_USER', 'root' );
define( 'DB_PASSWORD', 'root' );
define( 'DB_HOST', 'localhost' );
define( 'RO_NAME', 'local' );
define( 'RO_USER', 'root' );
define( 'RO_PASSWORD', 'root' );
define( 'RO_HOST', 'localhost' );
define( 'WP_ENVIRONMENT_TYPE', 'development' );
They match locally since I only have one db, but in prod they vary. I see this error in wp-admin:
Warning: compact(): Undefined variable $server in /Users/jones/Sites/collectivist.local/app/public/wp-content/db.php on line 722
When applying the code in this PR, the warning is removed. I'm open to suggestions for a better solution, or since I don't have WP_DEBUG
set in prod I assume I won't even see these PHP warnings but figured I'd submit this anyways. Thanks!
When I tail my logs locally, I do see several instances of this error:
WordPress database error 2022-06-22 14:47:11 Can't select global__r -
'referrer' => 'wp.local/',
'server' => ,
'host' => localhost,
'error' => ,
'errno' => 0,
'server_state' => down [ > 0.2 ] (61) 'Connection refused'
'lagged_status' => 3 for query
SELECT wp_blogs.blog_id
FROM wp_blogs
WHERE domain = 'wp.local' AND path = '/'
ORDER BY wp_blogs.blog_id ASC
LIMIT 1
made by WP_Site_Query::get_site_ids
Kudos, SonarCloud Quality Gate passed!
0 Bugs
0 Vulnerabilities
0 Security Hotspots
0 Code Smells
No Coverage information
0.0% Duplication
Resolves the following warnings when upgrading to PHP 8: