[wp-trac] [WordPress Trac] #47465: current_action function - return types

WordPress Trac noreply at wordpress.org
Mon Jun 3 12:32:37 UTC 2019


#47465: current_action function - return types
--------------------------+-----------------------------
 Reporter:  madeinua      |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  trunk
 Severity:  minor         |   Keywords:  needs-patch
  Focuses:                |
--------------------------+-----------------------------
 I received a PHP notice "Array to string conversion" that led me to the
 current_action() function in class-wp-list-table.php.

 This function can return an array as a valid value. For example this
 request will return an array:

 http://localhost/site/?action[]=1&action[]=2

 But in this case:

 PHPDoc is incorrect. Should be:

 {{{
 @return string|false|array
 }}}

 or/and

 this may break some of the scripts that use this function. simply because
 they use the result value as a string. Possible solution: add an
 additional check: IF array THAN take only the first value of the result.

 Thanks!

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


More information about the wp-trac mailing list