WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/15/2020 09:14:35 PM (12 months ago)
Author:
SergeyBiryukov
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 PHP 8 error.

Props jorbin.
Merges [49161] to trunk.
See #50913.

File:
1 edited

Legend:

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

    r49109 r49163  
    154154    }
    155155
    156     if ( ! extension_loaded( 'mysql' ) && ! extension_loaded( 'mysqli' ) && ! extension_loaded( 'mysqlnd' ) && ! file_exists( WP_CONTENT_DIR . '/db.php' ) ) {
     156    if ( ! extension_loaded( 'mysql' ) && ! extension_loaded( 'mysqli' ) && ! extension_loaded( 'mysqlnd' )
     157        // This runs before default constants are defined, so we can't assume WP_CONTENT_DIR is set yet.
     158        && ( defined( 'WP_CONTENT_DIR' ) && ! file_exists( WP_CONTENT_DIR . '/db.php' )
     159            || ! file_exists( ABSPATH . 'wp-content/db.php' ) )
     160    ) {
    157161        require_once ABSPATH . WPINC . '/functions.php';
    158162        wp_load_translations_early();
Note: See TracChangeset for help on using the changeset viewer.