Make WordPress Core

Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#61116 closed defect (bug) (fixed)

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

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

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 2 years ago.
Patch file.

Download all attachments as: .zip

Change History (7)

#1 @johnbillion
2 years ago

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

@amitraj2203
2 years ago

Patch file.

#2 @amitraj2203
2 years ago

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

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


2 years ago
#3

  • Keywords has-patch added; needs-patch removed

#4 @SergeyBiryukov
2 years ago

  • Milestone Future Release6.7

#5 @SergeyBiryukov
2 years ago

  • Owner set to SergeyBiryukov
  • Resolutionfixed
  • Status newclosed

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:


2 years ago
#6

Thanks for the PR! Merged in r58906.

Note: See TracTickets for help on using tickets.