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.
Built from https://develop.svn.wordpress.org/trunk@48868


git-svn-id: http://core.svn.wordpress.org/trunk@48630 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2020-08-26 16:57:16 +00:00
parent 9700ca0f55
commit aa803be1ec
2 changed files with 2 additions and 2 deletions

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 ) ); $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' ); return __get_option( 'siteurl' );
} }

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.6-alpha-48866'; $wp_version = '5.6-alpha-48868';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.