From c2e74ab915f8c85acb11c302a350ddbc7517173a Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sun, 11 Feb 2018 18:47:30 +0000 Subject: [PATCH] Database: In `require_wp_db()`, check if database constants are defined before using them. Otherwise, `wp-admin/setup-config.php` triggers an undefined constant warning in PHP 7.2. Props mariusvw, jryancard for initial patch. Fixes #35560. Built from https://develop.svn.wordpress.org/trunk@42701 git-svn-id: http://core.svn.wordpress.org/trunk@42529 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/load.php | 7 ++++++- wp-includes/version.php | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/wp-includes/load.php b/wp-includes/load.php index a29eed1002..71b3a4a3e7 100644 --- a/wp-includes/load.php +++ b/wp-includes/load.php @@ -418,7 +418,12 @@ function require_wp_db() { return; } - $wpdb = new wpdb( DB_USER, DB_PASSWORD, DB_NAME, DB_HOST ); + $dbuser = defined( 'DB_USER' ) ? DB_USER : ''; + $dbpassword = defined( 'DB_PASSWORD' ) ? DB_PASSWORD : ''; + $dbname = defined( 'DB_NAME' ) ? DB_NAME : ''; + $dbhost = defined( 'DB_HOST' ) ? DB_HOST : ''; + + $wpdb = new wpdb( $dbuser, $dbpassword, $dbname, $dbhost ); } /** diff --git a/wp-includes/version.php b/wp-includes/version.php index 885561b00d..e937edfdae 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '5.0-alpha-42700'; +$wp_version = '5.0-alpha-42701'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.