[wp-trac] [WordPress Trac] #61400: `wp_get_plugin_action_button()` can return `void`.

WordPress Trac noreply at wordpress.org
Fri Jun 7 18:39:30 UTC 2024


#61400: `wp_get_plugin_action_button()` can return `void`.
--------------------------+--------------------------------------
 Reporter:  costdev       |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  6.6
Component:  Plugins       |    Version:  6.5
 Severity:  normal        |   Keywords:  has-patch has-unit-tests
  Focuses:                |
--------------------------+--------------------------------------
 [57545] introduced `wp_get_plugin_action_button()`. This function is
 documented to return a string.

 However, the `return $button;` line is misplaced inside the following
 conditions:

 {{{#!php
 if ( current_user_can( 'install_plugins' ) || current_user_can(
 'update_plugins' ) ) {
 }}}

 As a result, when the user does not have the appropriate capabilities, the
 return line is not hit, and the function returns `void`.

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


More information about the wp-trac mailing list