WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#37123 closed defect (bug) (fixed)

Explicitly globalize $wpdb in either wp-settings.php or ms-settings.php

Reported by: danielbachhuber Owned by: SergeyBiryukov
Milestone: 4.6 Priority: normal
Severity: normal Version:
Component: Bootstrap/Load Keywords: needs-patch dev-feedback
Focuses: Cc:
PR Number:

Description

ms-settings.php implicitly expects $wpdb to be a globalized variable. However, neither wp-settings.php nor ms-settings.php explicitly globalizes it, which causes a fatal when wp-settings.php is called within a function.

$wpdb should be explicitly globalized, either in wp-settings.php or ms-settings.php. I don't have a strong preference as to which.

From https://github.com/wp-cli/wp-cli/pull/3031/commits/dc38f0834d6cd47f3c424e5ae2d357da81567f54

Change History (1)

#1 @SergeyBiryukov
3 years ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 37864:

Database: Explicitly globalize $wpdb in wp-settings.php in case WordPress isn't loaded in global scope.

See [18993] for $table_prefix.

Props danielbachhuber.
Fixes #37123.

Note: See TracTickets for help on using tickets.