[wp-trac] [WordPress Trac] #53411: Incorrect isset check in media bulk actions

WordPress Trac noreply at wordpress.org
Tue Jun 15 15:29:06 UTC 2021


#53411: Incorrect isset check in media bulk actions
--------------------------+-----------------------------
 Reporter:  david.binda   |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Media         |    Version:  trunk
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 After r51111 which makes sure that the `$post_ids` variable is always set,
 the `isset()` check later in the code is never matched.

 The checks failure results in an extra redirect to `wp-
 admin/upload.php?deleted=0` and then finally back to `wp-admin/upload.php`
 in case there are no IDs passed to some default bulk actions (eg.:
 delete).

 Prior this change, in case there were no IDs passed to the bulk action,
 the request was redirected directly to `wp-admin/upload.php`.

 It can be easily tested by visiting the `wp-admin/upload.php` screen and
 submitting any bulk action w/o selecting any media.

 My understanding is, that with r51111 in place, the checks in question
 should be updated to `empty()`. See attached patch.

 Related code lines:
 * https://core.trac.wordpress.org/browser/trunk/src/wp-
 admin/upload.php?rev=51111#L151
 * https://core.trac.wordpress.org/browser/trunk/src/wp-
 admin/upload.php?rev=51111#L172
 * https://core.trac.wordpress.org/browser/trunk/src/wp-
 admin/upload.php?rev=51111#L187 )

 Follow-up to #39589

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


More information about the wp-trac mailing list