From 82e4f7ed8f0ae99d7ca39b8524a47d93f9613ed0 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Thu, 15 Oct 2020 21:16:10 +0000 Subject: [PATCH] Bootstrap/Load: Don't assume `WP_CONTENT_DIR` is defined. When the `mysql` extention isn't loaded and a custom db dropin is not in place, we give folks a nice error. However, we can't assume that the `WP_CONTENT_DIR` constant is set yet since this runs before we define default constants. This fixes a PHP 8 error. Props jorbin. Merges [49161] to trunk. See #50913. Built from https://develop.svn.wordpress.org/trunk@49163 git-svn-id: http://core.svn.wordpress.org/trunk@48925 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/load.php | 6 +++++- wp-includes/version.php | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/wp-includes/load.php b/wp-includes/load.php index 34f30bcb03..7f4a878241 100644 --- a/wp-includes/load.php +++ b/wp-includes/load.php @@ -153,7 +153,11 @@ function wp_check_php_mysql_versions() { exit( 1 ); } - if ( ! extension_loaded( 'mysql' ) && ! extension_loaded( 'mysqli' ) && ! extension_loaded( 'mysqlnd' ) && ! file_exists( WP_CONTENT_DIR . '/db.php' ) ) { + if ( ! extension_loaded( 'mysql' ) && ! extension_loaded( 'mysqli' ) && ! extension_loaded( 'mysqlnd' ) + // This runs before default constants are defined, so we can't assume WP_CONTENT_DIR is set yet. + && ( defined( 'WP_CONTENT_DIR' ) && ! file_exists( WP_CONTENT_DIR . '/db.php' ) + || ! file_exists( ABSPATH . 'wp-content/db.php' ) ) + ) { require_once ABSPATH . WPINC . '/functions.php'; wp_load_translations_early(); $args = array( diff --git a/wp-includes/version.php b/wp-includes/version.php index 71c524978d..f2124ad125 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.6-alpha-49162'; +$wp_version = '5.6-alpha-49163'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.