Make WordPress Core

Opened 5 months ago

Closed 5 months ago

Last modified 5 months ago

#60521 closed defect (bug) (fixed)

Plugin updates from the plugin row don't work anymore

Reported by: presskopp's profile Presskopp Owned by: costdev's profile costdev
Milestone: 6.5 Priority: normal
Severity: normal Version: 6.5
Component: Plugins Keywords: has-screenshots has-patch has-testing-info commit
Focuses: Cc:

Description

Using a dev environment (6.5-alpha-57604) and updating any plugin on /wp-admin/plugins.php it won't work, throwing a console error. Coming from wp-admin/plugin-install.php it's still working.

Attachments (3)

plugin_update_fail.png (18.5 KB) - added by Presskopp 5 months ago.
Before fix added.png (205.8 KB) - added by krupajnanda 5 months ago.
This shows the error it throws before the fix was added.
Plugin-update-after-fix.png (347.8 KB) - added by krupajnanda 5 months ago.
This attachment shows the plugin is updated successfully after the fix is added.

Download all attachments as: .zip

Change History (15)

#2 @costdev
5 months ago

  • Keywords has-patch added
  • Milestone changed from Awaiting Review to 6.5
  • Version set to trunk

#3 @costdev
5 months ago

This is caused by a minor mistake that I made when calling the setCardButtonStatus() JS function. I mistakenly forgot to guard this to make sure the current page was one of the plugin install pages.

Should be a very simple fix. Patch incoming.

This ticket was mentioned in PR #6098 on WordPress/wordpress-develop by @costdev.


5 months ago
#4

Previously, the setCardButtonStatus() JS function was called when a card had the ID plugin-information-footer. However, the card will only exist on plugin install pages. This caused a failure when updating plugins from the plugin row on plugins.php due to an undefined card.

This adds a guard to ensure that the current page is one of the plugin install pages, preventing the error and allowing plugin updates from the plugins.php rows to work as expected.

#5 @costdev
5 months ago

  • Keywords needs-testing has-testing-info added

PR 6098 makes the change mentioned above and is ready for testing.

Testing Instructions

These steps define how to reproduce the issue, and indicate the expected behavior.

Steps to Reproduce

  1. Have a plugin that requires an update.
  2. Navigate to Plugins > Installed plugins.
  3. 🐞 Click Update now in the plugin row notice.
  4. Apply the PR.
  5. Build the environment with npm run build:dev.
  6. Repeat steps 1-3, ensuring you do a hard refresh between steps 2 and 3.

Expected Results

When testing a patch to validate it works as expected:

  • ✅ The update completes successfully and there are no errors in the console.

When reproducing a bug:

  • ❌ The update stalls and the DevTools console will have an error:

Uncaught TypeError: Cannot read properties of undefined. (reading "attr")

This ticket was mentioned in Slack in #core-test by costdev. View the logs.


5 months ago

#7 @costdev
5 months ago

  • Summary changed from Plugin updates don't work anymore to Plugin updates from the plugin row don't work anymore

#8 @huzaifaalmesbah
5 months ago

Test Report

Description

Patch tested: PR 6098

Environment

  • WordPress: 6.5-alpha-56966-src
  • PHP: 8.2.15
  • Server: nginx/1.25.3
  • Database: mysqli (Server: 8.0.36 / Client: mysqlnd 8.2.15)
  • Browser: Chrome 121.0.0.0
  • OS: macOS
  • Theme: Twenty Twenty-Four 1.0
  • MU Plugins: None activated
  • Plugins:
    • Test Reports 1.0.1

Actual Results

✅ Issue resolved with patch.

Screenshots

Before Apply Patch After Apply Patch ✅
https://i.ibb.co/9rQ59N6/Screenshot-2024-02-13-at-4-21-25-PM.png https://i.ibb.co/LSLcJ7v/Screenshot-2024-02-13-at-4-26-31-PM.png

#9 @krupajnanda
5 months ago

Cross verified the given PR with WordPress local setup.

Test Report

Description : After pulling the code from the given PR, I was successfully able to update the plugin without any console errors.

This report validates whether the indicated patch works as expected.

Patch tested with PR: https://github.com/WordPress/wordpress-develop/pull/6098

Environment

  • WordPress: 6.5-alpha-56966-src
  • PHP: 8.2.15
  • Server: nginx/1.25.3
  • Database: mysqli (Server: 8.0.36 / Client: mysqlnd 8.2.15)
  • Browser: Chrome 121.0.0.0
  • OS: macOS
  • Theme: Twenty Twenty-Four 1.0
  • MU Plugins: None activated
  • Plugins:
    • Hello Dolly 1.7.2
    • Test Reports 1.1.0

Actual Results

✅ Issue resolved with patch.

@krupajnanda
5 months ago

This shows the error it throws before the fix was added.

@krupajnanda
5 months ago

This attachment shows the plugin is updated successfully after the fix is added.

#10 @hellofromTonya
5 months ago

  • Keywords commit added; needs-testing removed

Patch: https://github.com/WordPress/wordpress-develop/pull/6098

I too can reproduce the bug and the patch resolves it.

Left a minor nit on the PR, though not a blocker.

Marking for commit.

#11 @costdev
5 months ago

  • Owner set to costdev
  • Resolution set to fixed
  • Status changed from new to closed

In 57615:

Plugins: Only set card button status on plugin install pages.

Previously, the setCardButtonStatus() JS function was called when a card had the ID 'plugin-information-footer'. However, the card will only exist on plugin install pages. This caused a failure when updating plugins from the plugin row on plugins.php due to an undefined $card variable.

This adds a guard to ensure that the current page is one of the plugin install pages, preventing the error and allowing plugin updates from the plugins.php rows to work as expected.

Follow-up to [57545].

Props Presskopp, huzaifaalmesbah, krupajnanda, hellofromTonya, krupalpanchal, costdev.
Fixes #60521.

@costdev commented on PR #6098:


5 months ago
#12

Committed in r57615.

Note: See TracTickets for help on using tickets.