Make WordPress Core

Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#54959 closed defect (bug) (fixed)

Incorrect type in docblock for `translations_api` and `translations_api_result` hooks

Reported by: volodymyrkolesnykov's profile volodymyrkolesnykov Owned by: audrasjb's profile audrasjb
Milestone: 6.0 Priority: normal
Severity: normal Version: 4.0
Component: I18N Keywords: has-patch
Focuses: docs Cc:


translation_api and translation_api_result filters are incorrectly marked as taking object as their first argument (,

The correct type should be array (, as json_decode() is asked to return an associative array; moreover, the code checks that the result is an array (, and consumers of translations_api() also expect to see an array (

Change History (7)

This ticket was mentioned in PR #2234 on WordPress/wordpress-develop by sjinks.

2 years ago

  • Keywords has-patch added

This PR fixes parameter/return value types for the translations_api() function and translations_api and translations_api_result hooks from object to array.

Trac ticket: [](

#2 @audrasjb
2 years ago

  • Component changed from General to I18N
  • Milestone changed from Awaiting Review to 6.0
  • Version changed from 5.9 to 4.0

#3 @audrasjb
2 years ago

  • Owner set to audrasjb
  • Status changed from new to reviewing

#4 @audrasjb
2 years ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 52645:

Docs: Fix incorrect type in translations_api and translations_api_result docblocks.

Before this changeset, translation_api and translation_api_result filters were incorrectly marked as taking object as their first argument. The correct type is an array as json_decode() is asked to return an associative array.

Props volodymyrkolesnykov.
Fixes #54959.

valerio-bozzolan commented on PR #2234:

2 years ago

Sorry for this question but how can someone from discover the original author (that is @sjinks and not @audrasjb)? Just for my curiosity.

sjinks commented on PR #2234:

2 years ago

@valerio-bozzolan "props volodymyrkolesnykov" in the commit message 🙂

Note: See TracTickets for help on using tickets.