Make WordPress Core

Opened 2 months ago

Closed 2 months ago

#61294 closed defect (bug) (fixed)

Plugin Dependencies: Ensure dependency detection for newly installed plugins

Reported by: costdev's profile costdev Owned by: hellofromtonya's profile hellofromTonya
Milestone: 6.5.4 Priority: normal
Severity: normal Version: 6.5
Component: Plugins Keywords: has-patch has-testing-info commit fixed-major dev-reviewed
Focuses: Cc:

Description

[57658] removed auto-deactivation and bootstrapping logic from the Plugin Dependencies feature. In doing so, initialization calls were added to various locations in Core to ensure dependencies were detected and ready to be checked. However, an initialization call was missed in the AJAX callback before checking plugin dependencies.

This means that a plugin's dependencies may not be detected, and lead to a false positive, which in turn allows the user to click Activate only to see a failure message.

Steps to reproduce

  1. Go to Plugins > Add New Plugin.
  2. Search WooCommerce, and find a plugin that requires it.
  3. Click on WooCommerce's "More details" link in the "Additional plugins are required" notice.
  4. Click Install Now in the modal.
  5. Close the modal.
  6. Refresh.
  7. Click Install Now on the dependent.
  8. 🐞 Once installed, it'll have a clickable Activate button, and when clicked, will fail.
  9. 🐞 Opening DevTools > Network, the final admin-ajax.php entry will show a response including "This has no required plugins", which is obviously incorrect.

When testing a patch to validate it works as expected:

  • ✅ The Activate button should not be clickable.

Change History (14)

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


2 months ago
#1

#2 @costdev
2 months ago

Additional props to @kevinwhoffman for discovering this issue and @afragen for early testing of the patch.

#3 @hellofromTonya
2 months ago

Aha, that's why I kept seeing "Activation failed" state rather than the "Activate" button being unavailable, i.e. when testing #61269.

#4 @hellofromTonya
2 months ago

  • Keywords needs-testing removed

Test Report

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

Steps to Reproduce or Test

Starting state: WooCommerce is installed, but not activated.
I tested this as part of my #61269 testing.

  1. Click Install Now on any of the plugins requiring WooCommerce as their dependency.
  2. 🐞 Once installed, it'll have a clickable Activate button, and when clicked, will fail.
  3. 🐞 Opening DevTools > Network, the final admin-ajax.php entry will show a response including "This has no required plugins", which is obviously incorrect.

Expected Results

When testing a patch to validate it works as expected:

  • ✅ The "Activate" button should be disabled.

When reproducing a bug:

  • ❌ 🐞 Once installed, it'll have a clickable Activate button, and when clicked, will fail.
  • ❌ 🐞 Opening DevTools > Network, the final admin-ajax.php entry will show a response including "This has no required plugins", which is obviously incorrect.

Environment

OS: macOS
Browser: Firefox 126.0
Web server: nginx
PHP: 8.3
Installed Plugins: WooCommerce 8.9.1
Activated Plugins: none
Theme: TT4

Actual Results

When reproducing a bug/defect:

  • ❌ 🐞 After installing any of the WooCommerce add-ons that require WooCommerce to be activated first, the Activate button is available and, after clicking, fails with a "Activation failed." error.

When testing the bugfix patch:

  • ✅ Issue resolved with patch.

I'm able to reproduce the reported issue. Confirmed the patch resolves it.

#5 @hellofromTonya
2 months ago

  • Keywords commit added

#6 @hellofromTonya
2 months ago

  • Owner set to hellofromTonya
  • Status changed from new to reviewing

Self-assigning for commit after thumbs up to include in 6.5.4 from @jorbin.

#7 @hellofromTonya
2 months ago

Retesting the PR with the latest trunk which now includes [58250] from #61319.

@hellofromTonya commented on PR #6630:


2 months ago
#8

Retested with current trunk which now includes 58250] from 61319. Works as expected and resolves the issue 👍

Preparing the commit.

#9 @hellofromTonya
2 months ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 58252:

Plugin Dependencies: Ensure dependency detection for newly installed plugins.

Resolves a bug by first initializing in the AJAX callback WP_Plugin_Dependencies::check_plugin_dependencies_during_ajax().

More details:

[57658] removed auto-deactivation and bootstrapping logic from the Plugin Dependencies feature. In doing so, initialization calls were added to various locations in Core to ensure dependencies were detected and ready to be checked. However, an initialization call was missed in the AJAX callback before checking plugin dependencies.

This means that a plugin's dependencies may not be detected, and lead to a false positive, which in turn allows the user to click Activate only to see a failure message.

Follow-up to [57658].

Props kevinwhoffman, costdev, afragen.
Fixes #61294.

#10 @hellofromTonya
2 months ago

  • Keywords dev-feedback added
  • Resolution fixed deleted
  • Status changed from closed to reopened

Reopening for 2nd committer sign-off to backport [58252] to the 6.5-branch.

#12 @hellofromTonya
2 months ago

  • Keywords fixed-major added

#13 @jorbin
2 months ago

  • Keywords dev-reviewed added; dev-feedback removed

[58252] looks good for backport to the 6.5 branch.

#14 @hellofromTonya
2 months ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 58255:

Plugin Dependencies: Ensure dependency detection for newly installed plugins.

Resolves a bug by first initializing in the AJAX callback WP_Plugin_Dependencies::check_plugin_dependencies_during_ajax().

More details:

[57658] removed auto-deactivation and bootstrapping logic from the Plugin Dependencies feature. In doing so, initialization calls were added to various locations in Core to ensure dependencies were detected and ready to be checked. However, an initialization call was missed in the AJAX callback before checking plugin dependencies.

This means that a plugin's dependencies may not be detected, and lead to a false positive, which in turn allows the user to click Activate only to see a failure message.

Follow-up to [57658].

Reviewed by jorbin.
Merges [58252] to the 6.5 branch.

Props kevinwhoffman, costdev, afragen.
Fixes #61294.

Note: See TracTickets for help on using tickets.