Opened 8 years ago
Closed 3 years ago
#40006 closed enhancement (fixed)
$response var in comments not an array but an object
Reported by: | davidmosterd | Owned by: | audrasjb |
---|---|---|---|
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)
Change History (23)
#2
@
8 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.
4 years ago
#4
@
3 years 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:
↓ 8
@
3 years ago
- Keywords needs-refresh added; needs-testing removed
Indeed, the first step is to update the DocBlock to reflect the actual parameter type.
They 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.
@
3 years ago
Upgrade/Install: Docs: Correct the documentation of the $response
parameter in the in_plugin_update_message-{$file}
action.
#8
in reply to:
↑ 5
@
3 years 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 :)
@
3 years ago
Docs: Add missing parameters available in the in_plugin_update_message-{$file}
filter. Follow-up to [51733].
This ticket was mentioned in Slack in #core by audrasjb. View the logs.
3 years ago
This ticket was mentioned in Slack in #core by audrasjb. View the logs.
3 years ago
This ticket was mentioned in Slack in #core-auto-updates by afragen. View the logs.
3 years ago
This ticket was mentioned in Slack in #core by audrasjb. View the logs.
3 years ago
#14
follow-up:
↓ 19
@
3 years ago
@type string $requires Required WordPress version.
@type string $tested Higher WordPress version the plugin has been tested with.
For consistency with another docblock in core (see src/wp-admin/includes/plugin.php:33
), I suggest:
@type string $requires Specify the minimum required WordPress version.
@type string $tested Specify the latest version of WordPress that the plugin has been tested with.
This ticket was mentioned in PR #1914 on WordPress/wordpress-develop by audrasjb.
3 years ago
#15
Trac ticket: https://core.trac.wordpress.org/ticket/40006
#16
@
3 years ago
- Owner changed from SergeyBiryukov to audrasjb
Thanks @costdev, I added them in the new PR. Self-assigning for commit
.
3 years ago
#18
Committed in https://core.trac.wordpress.org/changeset/52212
#19
in reply to:
↑ 14
@
3 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
It looks like [52212] accidentally reverts [51733], will commit a fix shortly.
Replying to costdev:
@type string $requires Required WordPress version.
@type string $tested Higher WordPress version the plugin has been tested with.
For consistency with another docblock in core (see
src/wp-admin/includes/plugin.php:33
), I suggest:
@type string $requires Specify the minimum required WordPress version.
@type string $tested Specify the latest version of WordPress that the plugin has been tested with.
Thanks! Consistency is great, but that DocBlock is an example of plugin headers, which is why it says "specify". Since we're dealing with a do_action()
call here, this is not the place to specify these values, we can only work with whatever values are already passed in the $response
object. So I think in this case it would be better to follow the DocBlock for the return result of get_plugin_data()
, or the DocBlock for the update_plugins_{$hostname}
filter, which documents pretty much the same values.
A Git to SVN patch that I hoped that worked :)