Upgrade/Install: Skip registering theme block patterns during the upgrade process.
This fixes a bug during the database upgrade process where a theme's `functions.php` file may not be loaded, leading to potential exceptions if the theme's pattern files use symbols (classes, functions, constants, etc.) that are declared only when the `functions.php` file is loaded. To do so, a check for `wp_get_active_and_valid_themes()` is added early to `_register_theme_block_patterns()`, which returns early if no active or valid themes are returned. Props fabiankaegy, rajinsharwar, pbiron, huzaifaalmesbah, hellofromTonya, peterwilsoncc, joemcgill. Fixes #59723. Built from https://develop.svn.wordpress.org/trunk@57021 git-svn-id: http://core.svn.wordpress.org/trunk@56532 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
06237953dd
commit
b4a6b21986
|
@ -328,6 +328,17 @@ function _register_remote_theme_patterns() {
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
function _register_theme_block_patterns() {
|
function _register_theme_block_patterns() {
|
||||||
|
|
||||||
|
/*
|
||||||
|
* During the bootstrap process, a check for active and valid themes is run.
|
||||||
|
* If no themes are returned, the theme's functions.php file will not be loaded,
|
||||||
|
* which can lead to errors if patterns expect some variables or constants to
|
||||||
|
* already be set at this point, so bail early if that is the case.
|
||||||
|
*/
|
||||||
|
if ( empty( wp_get_active_and_valid_themes() ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Register patterns for the active theme. If the theme is a child theme,
|
* Register patterns for the active theme. If the theme is a child theme,
|
||||||
* let it override any patterns from the parent theme that shares the same slug.
|
* let it override any patterns from the parent theme that shares the same slug.
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '6.5-alpha-57019';
|
$wp_version = '6.5-alpha-57021';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue