WordPress.org

Make WordPress Core

Opened 4 years ago

Last modified 7 weeks ago

#40006 reviewing enhancement

$response var in comments not an array but an object

Reported by: davidmosterd Owned by: SergeyBiryukov
Milestone: 5.9 Priority: normal
Severity: normal Version: 3.8
Component: Upgrade/Install Keywords: has-patch needs-testing
Focuses: docs Cc:

Description

In the file wp-admin/includes/update.php there is an action do_action( "in_plugin_update_message-{$file}", $plugin_data, $response ); . The comments declares $response as an array but its and object containing the plugin data. The list of plugin data also seems somewhat incomplete. But I'm unsure if all fields I see are always present. The property "tested" seems useful to add at least.

Attachments (1)

40006.diff (1.0 KB) - added by davidmosterd 4 years ago.
A Git to SVN patch that I hoped that worked :)

Download all attachments as: .zip

Change History (5)

@davidmosterd
4 years ago

A Git to SVN patch that I hoped that worked :)

#1 @davidmosterd
4 years ago

  • Keywords has-patch added

#2 @johnbillion
4 years ago

  • Component changed from Comments to Upgrade/Install
  • Keywords needs-testing added
  • Version trunk deleted

This ticket was mentioned in Slack in #core-test by hellofromtonya. View the logs.


2 months ago

#4 @SergeyBiryukov
7 weeks ago

  • Milestone changed from Awaiting Review to 5.9
  • Owner set to SergeyBiryukov
  • Status changed from new to reviewing
  • Version set to 3.8

Hi there, welcome to WordPress Trac!

Thanks for the ticket, sorry it took so long for someone to get back to you.

Setting the version to 3.8, as the documentation was added in [26540] / #26252.

The in_plugin_update_message-{$file} action itself was added in [11193] / #9553.

A corresponding in_theme_update_message-{$theme_key} action for themes was added in [16141] / #14897.

It looks like the $response parameter here is an object for plugins, but is indeed an array for themes. I think it's worth discussing whether we want to make it consistent for both, i.e. make it an array for plugins too, to match the documented value.

On second thought, since the action was added more than 12 years ago, changing the parameter type now would break any custom code relying on it being an object, so perhaps we should just accept the inconsistency and correct the documentation as suggested in 40006.diff. A brief search in the Plugin Directory shows that the action is used in quite a few plugins.

Note: See TracTickets for help on using tickets.