Make WordPress Core

Changeset 49161 for branches/5.5


Ignore:
Timestamp:
10/15/2020 05:05:48 PM (4 years ago)
Author:
jorbin
Message:

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 PHP8 error.

See: #50913.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/5.5/src/wp-includes/load.php

    r48896 r49161  
    113113    }
    114114
    115     if ( ! extension_loaded( 'mysql' ) && ! extension_loaded( 'mysqli' ) && ! extension_loaded( 'mysqlnd' ) && ! file_exists( WP_CONTENT_DIR . '/db.php' ) ) {
     115    if ( ! extension_loaded( 'mysql' ) && ! extension_loaded( 'mysqli' ) && ! extension_loaded( 'mysqlnd' )
     116            // This runs before default constants are defined, so we can't assume WP_CONTENT_DIR is set yet
     117            && ( ( defined( 'WP_CONTENT_DIR' ) && ! file_exists( WP_CONTENT_DIR . '/db.php' ) )
     118                || ( ! file_exists( ABSPATH . 'wp-content/db.php' ) ) )
     119        ) {
    116120        require_once ABSPATH . WPINC . '/functions.php';
    117121        wp_load_translations_early();
Note: See TracChangeset for help on using the changeset viewer.