[wp-trac] [WordPress Trac] #61117: Guard condition in `delete_temp_backup()` shouldn't return early

WordPress Trac noreply at wordpress.org
Wed May 1 22:08:08 UTC 2024


#61117: Guard condition in `delete_temp_backup()` shouldn't return early
-----------------------------+----------------------------
 Reporter:  johnbillion      |      Owner:  (none)
     Type:  defect (bug)     |     Status:  new
 Priority:  low              |  Milestone:  Future Release
Component:  Upgrade/Install  |    Version:  6.3
 Severity:  normal           |   Keywords:  needs-patch
  Focuses:                   |
-----------------------------+----------------------------
 In the `delete_temp_backup()` function there is a guard condition which
 triggers an early return if the arguments for any of the temp backups are
 empty ([https://github.com/WordPress/wordpress-
 develop/blob/ebc66bb9a13180d85f5a8b374d85ce14e0b7b2db/src/wp-
 admin/includes/class-wp-upgrader.php#L1200-L1202 ref]).

 This prevents further iteration of the array of temp backups. In theory
 this prevents the deletion of a valid backup that exists in in a
 subsequent element in the array.

 I think the `return false` should be replaced with `continue`.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/61117>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list