Make WordPress Core

Opened 3 years ago

Last modified 18 months ago

#59402 assigned defect (bug)

Plugin cannot be uninstalled if uninstall crashes

Reported by: kkmuffme Owned by:
Priority: normal Milestone: Future Release
Component: Plugins Version: 2.7
Severity: normal Keywords: has-patch changes-requested needs-test-info
Cc: Focuses:

Description

If a plugin register the "register_uninstall_hook" conditionally (e.g. only on activation,...) a plugin cannot be uninstalled anymore if it exits (e.g. timeout,...) during uninstall.

This is because the uninstall file/callback is removed from the option before the actual uninstall happens:
​https://github.com/WordPress/wordpress-develop/blob/trunk/src/wp-admin/includes/plugin.php#L1253
​https://github.com/WordPress/wordpress-develop/blob/trunk/src/wp-admin/includes/plugin.php#L1269

Change History (17)

#1 @sabernhardt
3 years ago

  • Component General → Plugins

This ticket was mentioned in ​PR #6018 on ​WordPress/wordpress-develop by ​@kkmuffme.


3 years ago
#2

  • Keywords has-patch added

Plugin cannot be uninstalled if uninstall times out/crashes and hook is registered conditionally.
This PR will remove the plugin from uninstallable plugins only after the uninstall hook ran to fix this bug.

This ticket was mentioned in ​Slack in #core by kkmuffme. ​View the logs.


3 years ago

#4 @swissspidy
3 years ago

  • Milestone Awaiting Review → 6.5

Would be good to check out the code history to see why it was added this way.

Apart from that it looks reasonable.

#5 @swissspidy
3 years ago

  • Owner set to swissspidy
  • Status new → assigned
  • Version → 2.7

Introduced in 8585 / #5625 and mostly unchanged since.

#6 @swissspidy
3 years ago

  • Keywords early needs-testing added
  • Milestone 6.5 → 6.6

Lets fix this early in 6.6 as this code hasn't been touched in ages and it would be good to test it longer in a cycle.

#7 @kkmuffme
3 years ago

@swissspidy could you merge this now, since WP 6.5 is released and this is the earliest possible for 6.6

#8 @rajinsharwar
3 years ago

  • Keywords changes-requested added

Added some comments @kkmuffme. I believe the patch still needs some work, and thorough testing to avoid any regression later in the release. Also, we may need some unit tests for this as well for this case. if you could get some time to work on some unit tests, we may get this merged early with 6.6. :)

#9 @swissspidy
3 years ago

  • Owner swissspidy removed

#10 @kkmuffme
3 years ago

@rajinsharwar could you please let me know where you added the comments? I see none on the PR.

Also, we may need some unit tests for this as well for this case

Any existing unit tests already cover this, don't they?
The changes of this PR cannot be unit tested per se in addition to any existing uninstall unit tests, since this PR fixes an issue where the code exits (fatal, timeout, explicit exit).

#11 @rajinsharwar
2 years ago

@kkmuffme The comments were pending, can you check now?

#12 @kkmuffme
2 years ago

@rajinsharwar replied

This ticket was mentioned in ​Slack in #core by nhrrob. ​View the logs.


2 years ago

#14 @oglekler
2 years ago

  • Milestone 6.6 → 6.7

This is an early ticket and at is too late for it in this cycle, so, I am moving it to the next milestone.

#15 @stoyangeorgiev
2 years ago

  • Milestone 6.7 → Future Release

Discussed at at a bug-scrub session.

props to @khoipro for checking this one.

The PR needs some additional changes that were commented. Moving this one to a Future Release until then.

#16 @SirLouen
18 months ago

  • Keywords needs-test-info added; needs-testing removed

@kkmuffme can you provide ​a minimal testing use-case to reproduce this issue? It can be a sample minimal plugin that executes the exact functionality you mention in the OP and causes the trouble.

Try to sort according to the proposed changes by @rajinsharwar, but don't necessarily get blocked by them if he is not going to answer you. We can try to push this forward, if you can provide the changes and the use-case as I mentioned above.

#17 @SirLouen
18 months ago

  • Keywords early removed
Note: See TracTickets for help on using tickets.