Upgrade/Install: Make the check for empty home option in __get_option() more resilient.

This addresses a regression in [47808], where the `home` check expected an empty string to use `siteurl` as a fallback, but `wpdb::get_var()` returns `null` if the option is empty.

Props fjarrett.
Fixes #51011.

git-svn-id: https://develop.svn.wordpress.org/trunk@48868 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2020-08-26 16:55:36 +00:00
parent 2a9c68872e
commit c7f5af72dc

View File

@ -2567,7 +2567,7 @@ function __get_option( $setting ) { // phpcs:ignore WordPress.NamingConventions.
$option = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = %s", $setting ) );
if ( 'home' === $setting && '' === $option ) {
if ( 'home' === $setting && ! $option ) {
return __get_option( 'siteurl' );
}