[wp-trac] [WordPress Trac] #59723: Pattern file containing PHP constant from theme causes fatal error on update to WordPress 6.4

WordPress Trac noreply at wordpress.org
Fri Oct 27 19:23:39 UTC 2023


#59723: Pattern file containing PHP constant from theme causes fatal error on
update to WordPress 6.4
-------------------------------------------------+-------------------------
 Reporter:  fabiankaegy                          |       Owner:  joemcgill
     Type:  defect (bug)                         |      Status:  closed
 Priority:  high                                 |   Milestone:  6.4
Component:  Upgrade/Install                      |     Version:  trunk
 Severity:  normal                               |  Resolution:  fixed
 Keywords:  has-patch has-testing-info commit    |     Focuses:
  dev-reviewed fixed-major                       |
-------------------------------------------------+-------------------------
Changes (by joemcgill):

 * status:  reopened => closed
 * resolution:   => fixed


Comment:

 In [changeset:"57023" 57023]:
 {{{
 #!CommitTicketReference repository="" revision="57023"
 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.
 Reviewed by hellofromTonya.
 Merges [57021] to the 6.4 branch.
 Fixes #59723.
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/59723#comment:30>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list