WordPress.org

Make WordPress Core

Changeset 43722


Ignore:
Timestamp:
10/12/2018 11:15:46 AM (12 months ago)
Author:
SergeyBiryukov
Message:

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.
Merges [42701] to the 5.0 branch.
Fixes #35560.

Location:
branches/5.0
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.0

  • branches/5.0/src/wp-includes/load.php

    r41922 r43722  
    402402    }
    403403
    404     $wpdb = new wpdb( DB_USER, DB_PASSWORD, DB_NAME, DB_HOST );
     404    $dbuser     = defined( 'DB_USER' ) ? DB_USER : '';
     405    $dbpassword = defined( 'DB_PASSWORD' ) ? DB_PASSWORD : '';
     406    $dbname     = defined( 'DB_NAME' ) ? DB_NAME : '';
     407    $dbhost     = defined( 'DB_HOST' ) ? DB_HOST : '';
     408
     409    $wpdb = new wpdb( $dbuser, $dbpassword, $dbname, $dbhost );
    405410}
    406411
Note: See TracChangeset for help on using the changeset viewer.