Make WordPress Core

Opened 4 months ago

Closed 4 weeks ago

Last modified 4 weeks ago

#61116 closed defect (bug) (fixed)

Return value of `_wp_delete_all_temp_backups()` isn't used

Reported by: johnbillion's profile johnbillion Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 6.7 Priority: normal
Severity: normal Version: 6.3
Component: Upgrade/Install Keywords: has-patch
Focuses: Cc:

Description

The _wp_delete_all_temp_backups() function returns a WP_Error object when there's a failure condition, but this function is only used as a cron event callback function so the return value is not used anywhere.

As core has no error handling for cron events, I recommend triggering an error for these conditions (probably via wp_trigger_error()) and then doing early returns so the function returns void.

Attachments (1)

patch.diff (987 bytes) - added by amitraj2203 4 months ago.
Patch file.

Download all attachments as: .zip

Change History (7)

#1 @johnbillion
4 months ago

Correction: This function is used as a shutdown action callback (ref), not a cron event callback. Same problem though.

@amitraj2203
4 months ago

Patch file.

#2 @amitraj2203
4 months ago

Hi @johnbillion I have submitted the patch for the same.

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


4 months ago
#3

  • Keywords has-patch added; needs-patch removed

#4 @SergeyBiryukov
6 weeks ago

  • Milestone changed from Future Release to 6.7

#5 @SergeyBiryukov
4 weeks ago

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

In 58906:

Upgrade/Install: Remove the return value of _wp_delete_all_temp_backups().

This function is only utilized as a shutdown action callback, so the return value is not used anywhere.

wp_trigger_error() is now used instead under the same conditions.

Follow-up to [55720], [56342].

Props johnbillion, amitraj2203, narenin.
Fixes #61116.

@SergeyBiryukov commented on PR #6565:


4 weeks ago
#6

Thanks for the PR! Merged in r58906.

Note: See TracTickets for help on using tickets.