Opened 9 months ago
Last modified 3 months ago
#61055 new defect (bug)
wp_update_plugins irregular transient handling.
Reported by: | Cybr | Owned by: | |
---|---|---|---|
Milestone: | 6.8 | Priority: | normal |
Severity: | normal | Version: | 6.6 |
Component: | Plugins | Keywords: | has-patch needs-testing needs-testing-info |
Focuses: | Cc: |
Description
When creating $updates
in wp_update_plugins()
, its properties are populated immediately.
However, one property is missing, which is used later: checked
.
When hooking into pre_set_site_transient_update_plugins
, the checked
property will be available sporadically because of this, depending on whether the $time_not_changed && ! $extra_stats
branch is executed or not.
Another noteworthy issue with this function is that its implementation of set_site_transient( 'update_plugins', ... );
uses both the values $current
and $updates
. They store different objects at different times (1, 2).
Prepopulating both values with the same object properties would help prevent object-typing issues.
Change History (14)
#2
@
9 months ago
- Component changed from General to Plugins
- Milestone changed from Awaiting Review to 6.6
This ticket was mentioned in PR #6736 on WordPress/wordpress-develop by @snehapatil02.
7 months ago
#3
- Keywords has-patch added
### Ticket: https://core.trac.wordpress.org/ticket/61055
## Description
Ensure consistent handling of 'checked' property in wp_update_plugins()
function.
- This PR addresses the irregular handling of the transient in the
wp_update_plugins()
function, ensuring that the 'checked' property is always available when hooking intopre_set_site_transient_update_plugins
. - It also ensures consistency between the
$current
and$updates
objects, preventing potential issues caused by different object properties at different times.
## Changes Made
- Initialize the 'checked' property in the
$current
object if it is not already set. - Ensure that the 'checked' property is always assigned to the
$updates
object. - Prepopulate both
$current
and$updates
with the same 'checked' property to prevent object-typing issues. - Update the
set_site_transient('update_plugins', $updates)
to store the$updates
object consistently.
siliconforks commented on PR #6736:
7 months ago
#4
Note that there is already an existing patch (which is intended to address this problem) in this ticket:
#5
follow-up:
↓ 6
@
7 months ago
This might be a duplicate of #44118; though addressing a different issue, its resolution appears to be the same.
This ticket was mentioned in Slack in #core by nhrrob. View the logs.
7 months ago
This ticket was mentioned in Slack in #core by nhrrob. View the logs.
7 months ago
#10
@
7 months ago
- Milestone changed from 6.6 to 6.7
We are very close to RC1.
Looks like it still needs testing.
Punting to 6.7
This ticket was mentioned in Slack in #core by chaion07. View the logs.
3 months ago
#12
follow-up:
↓ 13
@
3 months ago
- Keywords needs-testing-info added
Thanks @Cybr for reporting this. We reviewed this Ticket during a recent bug-scrub session. Based on the feedback received we are adding the nedds-testing-info keyword to help with anyone hoping to run the tests. Thanks.
Props to @pratiklondhe
Cheers!
#13
in reply to:
↑ 12
@
3 months ago
Replying to chaion07:
Thanks @Cybr for reporting this. We reviewed this Ticket during a recent bug-scrub session. Based on the feedback received we are adding the nedds-testing-info keyword to help with anyone hoping to run the tests. Thanks.
Have you looked at #44118 ? There are fairly detailed steps for reproducing this issue there. Basically, to test a patch, you would need to run steps 1 and 2 before and after applying the patch. (You could also look directly at the update_plugins
transient before running step 2. Without any patch, you will see that it is missing a checked
property. A working patch should fix this so that it always has the checked
property.)
Related: #44118