From 6ef47e555f2a631d471675af04e985cdbb424e70 Mon Sep 17 00:00:00 2001 From: David Baumwald Date: Fri, 7 Jan 2022 17:53:27 +0000 Subject: [PATCH] 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. git-svn-id: https://develop.svn.wordpress.org/trunk@52539 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/class-wp-automatic-updater.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/wp-admin/includes/class-wp-automatic-updater.php b/src/wp-admin/includes/class-wp-automatic-updater.php index aded48b275..7ba6b71b52 100644 --- a/src/wp-admin/includes/class-wp-automatic-updater.php +++ b/src/wp-admin/includes/class-wp-automatic-updater.php @@ -419,9 +419,10 @@ class WP_Automatic_Updater { return false; } - // Core doesn't output this, so let's append it so we don't get confused. + // Core doesn't output this, so let's append it, so we don't get confused. if ( is_wp_error( $upgrade_result ) ) { - $skin->error( __( 'Installation failed.' ), $upgrade_result ); + $upgrade_result->add( 'installation_failed', __( 'Installation failed.' ) ); + $skin->error( $upgrade_result ); } else { $skin->feedback( __( 'WordPress updated successfully.' ) ); }