[wp-trac] [WordPress Trac] #44990: Unhandle post_ids variable in custom bulk actions

WordPress Trac noreply at wordpress.org
Fri Oct 5 06:01:01 UTC 2018


#44990: Unhandle post_ids variable in custom bulk actions
-------------------------------------------------+-------------------------
 Reporter:  gaupoit                              |       Owner:  (none)
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  Awaiting
                                                 |  Review
Component:  Media                                |     Version:  4.9.8
 Severity:  minor                                |  Resolution:
 Keywords:  dev-feedback ux-feedback 2nd-        |     Focuses:
  opinion                                        |
-------------------------------------------------+-------------------------
Changes (by garrett-eclipse):

 * keywords:  dev-feedback ux-feedback => dev-feedback ux-feedback 2nd-
               opinion


Comment:

 Thanks @gaupoit, I tweaked your comment to switch from master branch
 making it a permalink as master often changes.

 Replying to [comment:2 gaupoit]:
 > However, the problem is here
 https://github.com/WordPress/WordPress/blob/4.9.8/wp-admin/upload.php#L170
 the variable $post_ids is never handled.

 By unhandled I'm assuming you're speaking of the `isset` check on the
 `$post_ids` array which isn't done before firing the action? If I
 misunderstood please correct me. But with that in mind.

 Checking the other actions -
 https://github.com/WordPress/WordPress/search?q=handle_bulk_actions-&type=Code
 [[BR]]
 Only the `/wp-admin/edit.php` does a global check before entering the
 conditional logic;[[BR]]
 https://github.com/WordPress/WordPress/blob/56c162fbc9867f923862f64f1b4570d885f1ff03
 /wp-admin/edit.php#L99-L102

 Other instances either use the foreach around the switch statements or use
 an isset within the switch statement before the foreach.

 In most cases it seems the check is avoided prior to the action to allow
 it to fire even when the ids array is empty. I'm unsure if that's intended
 by design so adding `2nd-opinion`. And wanted to flag it's existing use in
 Plugins;[[BR]]
 https://wpdirectory.net/search/01CS1BY2N61SNYPJBRVJXX5N7C [[BR]]
 *If any do actions when they receive an empty array then introducing a
 check in core would avoid the action and result in those actions never
 firing. This is my only concern with adding a global check, it would force
 a global redirect location without providing the ability to plugins/etc to
 override that.

 And just for reference, the docblock associated to this action is found
 here;[[BR]]
 https://github.com/WordPress/WordPress/blob/4.9.8/wp-admin/edit-
 comments.php#L85-L103

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/44990#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list