#54959 closed defect (bug) (fixed)
Incorrect type in docblock for `translations_api` and `translations_api_result` hooks
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 6.0 | Priority: | normal |
| Severity: | normal | Version: | 4.0 |
| Component: | I18N | Keywords: | has-patch |
| Focuses: | docs | Cc: |
Description
translation_api and translation_api_result filters are incorrectly marked as taking object as their first argument (https://github.com/WordPress/WordPress/blob/5.9/wp-admin/includes/translation-install.php#L32, https://github.com/WordPress/WordPress/blob/5.9/wp-admin/includes/translation-install.php#L105).
The correct type should be array (https://github.com/WordPress/WordPress/blob/5.9/wp-admin/includes/translation-install.php#L85), as json_decode() is asked to return an associative array; moreover, the code checks that the result is an array (https://github.com/WordPress/WordPress/blob/5.9/wp-admin/includes/translation-install.php#L86), and consumers of translations_api() also expect to see an array (https://github.com/WordPress/WordPress/blob/5.9/wp-admin/includes/translation-install.php#L135).
Change History (7)
This ticket was mentioned in PR #2234 on WordPress/wordpress-develop by sjinks.
4 years ago
#1
- Keywords has-patch added
#2
@
4 years ago
- Component changed from General to I18N
- Milestone changed from Awaiting Review to 6.0
- Version changed from 5.9 to 4.0
4 years ago
#5
committed in https://core.trac.wordpress.org/changeset/52645, thanks!
valerio-bozzolan commented on PR #2234:
4 years ago
#6
Sorry for this question but how can someone from https://core.trac.wordpress.org/changeset/52645 discover the original author (that is @sjinks and not @audrasjb)? Just for my curiosity.
This PR fixes parameter/return value types for the
translations_api()function andtranslations_apiandtranslations_api_resulthooks fromobjecttoarray.Trac ticket: [](https://core.trac.wordpress.org/ticket/54959)