Make WordPress Core

Changeset 52539


Ignore:
Timestamp:
01/07/2022 05:53:27 PM (3 years ago)
Author:
davidbaumwald
Message:

Upgrade/Install: Fix parameter count in error call when an automatic core upgrade fails.

During automatic core upgrades, if installation results in a WP_Error, the error method is called on the skin with the details. However, in this case, two parameters are passed to $skin->error, but only one is accepted. This change passes only the running WP_Error instance as the sole parameter to $skin->error.

Also, this change adds an additional error to $upgrade_result before finally being passed to $skin->error, indicating that the installation failed. This adds additional context to the failure.

Props desrosj, sainthkh, devutpol, SergeyBiryukov.
Fixes #53284.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-automatic-updater.php

    r52214 r52539  
    420420            }
    421421
    422             // Core doesn't output this, so let's append it so we don't get confused.
     422            // Core doesn't output this, so let's append it, so we don't get confused.
    423423            if ( is_wp_error( $upgrade_result ) ) {
    424                 $skin->error( __( 'Installation failed.' ), $upgrade_result );
     424                $upgrade_result->add( 'installation_failed', __( 'Installation failed.' ) );
     425                $skin->error( $upgrade_result );
    425426            } else {
    426427                $skin->feedback( __( 'WordPress updated successfully.' ) );
Note: See TracChangeset for help on using the changeset viewer.