Skip to content

14.5.3 - Fatal Error when installing plugins/themes. #45886

@costdev

Description

@costdev

Description

With Gutenberg 14.5.3 active on WordPress trunk, installing themes produces a Fatal Error in _wp_theme_has_theme_json_clean_cache_upon_upgrading_active_theme().

This is caused by the $accepted_args not being specified when hooking upgrader_process_complete.

In lib/compat/wordpress-6.2/default-filters.php, this line:

add_action( 'upgrader_process_complete', '_wp_theme_has_theme_json_clean_cache_upon_upgrading_active_theme' );

Should be:

add_action( 'upgrader_process_complete', '_wp_theme_has_theme_json_clean_cache_upon_upgrading_active_theme', 10, 2 );

Introduced in #45543.

Step-by-step reproduction instructions

  1. Install and activate Gutenberg 14.5.3.
  2. Navigate to Appearance > Themes > Add New.
  3. Install a theme. 🐞

Screenshots, screen recording, code snippet

PHP Fatal error:  Uncaught ArgumentCountError: Too few arguments to function _wp_theme_has_theme_json_clean_cache_upon_upgrading_active_theme(), 1 passed in /wp-includes/class-wp-hook.php on line 310 and exactly 2 expected in src/wp-content/plugins/gutenberg/lib/compat/wordpress-6.2/get-global-styles-and-settings.php:67
Stack trace:
/wp-includes/class-wp-hook.php(310): _wp_theme_has_theme_json_clean_cache_upon_upgrading_active_theme()
/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters()
/wp-includes/plugin.php(517): WP_Hook->do_action()
/wp-admin/includes/class-wp-upgrader.php(875): do_action()
/wp-admin/includes/class-theme-upgrader.php(250): WP_Upgrader->run()
/wp-admin/includes/ajax-actions.php(4174): Theme_Upgrader->install( in /wp-content/plugins/gutenberg/lib/compat/wordpress-6.2/get-global-styles-and-settings.php on line 67

Environment info

  • Server: Apache (Linux)
  • WordPress: 6.2-alpha-54642-src
  • Browser: Chrome 107.0.0.0
  • OS: Windows 10
  • Theme: Twenty Twenty-Two
  • Plugins:
    • Gutenberg 14.5.3

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions