From d2993600fef0b2f77558e1f235c27a38de160115 Mon Sep 17 00:00:00 2001 From: Jb Audras Date: Thu, 6 Jul 2023 13:52:56 +0000 Subject: [PATCH] Boostrap/Load: Incorrect condition in `wp_check_php_mysql_versions()`. This changeset adds a check for the existence of `db.php` at the default path `ABSPATH . 'wp-content/db.php'`, even if `WP_CONTENT_DIR` is defined and `db.php` is placed in `WP_CONTENT_DIR`. Follow-up to [49161]. Props mikeyzm, SergeyBiryukov, hztyfoon, Fixes #58201. git-svn-id: https://develop.svn.wordpress.org/trunk@56152 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/load.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/wp-includes/load.php b/src/wp-includes/load.php index fb5f98d261..fcd5cf256d 100644 --- a/src/wp-includes/load.php +++ b/src/wp-includes/load.php @@ -162,10 +162,12 @@ function wp_check_php_mysql_versions() { exit( 1 ); } - if ( ! function_exists( 'mysqli_connect' ) && ! function_exists( 'mysql_connect' ) - // 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' ) ) + // This runs before default constants are defined, so we can't assume WP_CONTENT_DIR is set yet. + $wp_content_dir = defined( 'WP_CONTENT_DIR' ) ? WP_CONTENT_DIR : ABSPATH . 'wp-content'; + + if ( ! function_exists( 'mysqli_connect' ) + && ! function_exists( 'mysql_connect' ) + && ! file_exists( $wp_content_dir . '/db.php' ) ) { require_once ABSPATH . WPINC . '/functions.php'; wp_load_translations_early();