WordPress.org

Make WordPress Core

Opened 5 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
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 (3)

40006.diff (1.0 KB) - added by davidmosterd 5 years ago.
A Git to SVN patch that I hoped that worked :)
40006.1.diff (721 bytes) - added by audrasjb 7 weeks ago.
Upgrade/Install: Docs: Correct the documentation of the $response parameter in the in_plugin_update_message-{$file} action.
40006.2.3.diff (1.4 KB) - added by audrasjb 7 weeks ago.
Docs: Add missing parameters available in the in_plugin_update_message-{$file} filter. Follow-up to [51733].

Download all attachments as: .zip

Change History (12)

@davidmosterd
5 years ago

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

#1 @davidmosterd
5 years ago

  • Keywords has-patch added

#2 @johnbillion
5 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.


5 months ago

#4 @SergeyBiryukov
4 months 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.

#5 follow-up: @audrasjb
7 weeks ago

  • Keywords needs-refresh added; needs-testing removed

Indeed, the first step is to update the DocBlock to reflect the actual parameter type.

Then it would also be useful to add the missing parameters available in the $response object. But I think it's better to separate those two steps.

Last edited 7 weeks ago by audrasjb (previous) (diff)

@audrasjb
7 weeks ago

Upgrade/Install: Docs: Correct the documentation of the $response parameter in the in_plugin_update_message-{$file} action.

#6 @audrasjb
7 weeks ago

  • Keywords needs-refresh removed

#7 @SergeyBiryukov
7 weeks ago

In 51733:

Docs: Correct documentation for the in_plugin_update_message-{$file} filter.

The $response parameter is an object, not an array.

This is a minor inconsistency with the corresponding in_theme_update_message-{$theme_key} action for themes, where the $response parameter is an array.

For backward compatibility, it is safer not to change the parameter type at this point, but to make sure the documentation is correct.

Follow-up to [11193], [16141], [26540].

Props davidmosterd, audrasjb, SergeyBiryukov.
See #40006.

#8 in reply to: ↑ 5 @SergeyBiryukov
7 weeks ago

Replying to audrasjb:

Then it would also be useful to add the missing parameters available in the $response object.

Keeping the ticket open for this :)

@audrasjb
7 weeks ago

Docs: Add missing parameters available in the in_plugin_update_message-{$file} filter. Follow-up to [51733].

#9 @audrasjb
7 weeks ago

Just added the missing parameters :)

Note: See TracTickets for help on using tickets.