WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#31347 closed defect (bug) (duplicate)

Issue with translations api return (undefined index in settings)

Reported by: OriginalEXE Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: I18N Keywords:
Focuses: Cc:
PR Number:

Description

Hi there,

WordPress version: 4.1
Theme active: Twenty Fourteen (irrelevant)
Plugins active: none
Error: Undefined offset: 1 (wp-includes/l10n.php:945)
How to reproduce: Go to wp-admin -> Settings -> General and then check your error report logs

So it seems that an array of languages returned by WP api call has an issue. I inspected and the language in question is "Hazaragi" (haz).

The issue happens when languages are being listed in language selection "dropdown", the actual code is:

esc_attr( $translation['iso'][1] )

but upon inspection, and for this language only, iso is available under key '2' and not '1', not sure why.

I only found this problem today, not sure if I did not notice or something was changed recently in api response. In any case, my tickets search did not result in finding the same report so there you go.

Change History (2)

#1 @SergeyBiryukov
5 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #31319.

#2 @jmaberle
5 years ago

the problem come from

function translations_api()

wp_remote_post (https://api.wordpress.org/translations/core/1.0/)

return

...
"language":"haz","version":"4.1.1","updated":"2015-02-12 01:05:09","english_name":"Hazaragi","native_name":"\u0647\u0632\u0627\u0631\u0647 \u06af\u06cc","package":"https:\/\/downloads.wordpress.org\/translation\/core\/4.1.1
\/haz.zip","iso":{"2":"haz"}
...

the language haz has no iso[1]

Note: See TracTickets for help on using tickets.