WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 5 years ago

#11832 closed defect (bug) (fixed)

merge_with() inconsistency in load_textdomain()

Reported by: SergeyBiryukov Owned by: westi
Milestone: 3.0 Priority: normal
Severity: major Version: 2.9
Component: I18N Keywords:
Focuses: Cc:

Description

This code is used in wp-includes/pomo/translations.php:

function merge_with(&$other) {
	$this->entries = array_merge($this->entries, $other->entries);
}

It creates problems with numeric keys. For example, _e('2') outputs 4 on a localized version, regardless of the value in a .mo file.
Perhaps something like this should be used:

function merge_with(&$other) {
	foreach ( $other->entries as $key => $value )
		$this->entries[$key] = $value;
}

Change History (6)

comment:1 @nbachiyski5 years ago

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

comment:2 @SergeyBiryukov5 years ago

The current WordPress 3.0-alpha revision still uses array_merge(). Will it be synchronized with GlotPress?

comment:3 @nbachiyski5 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

comment:4 @nbachiyski5 years ago

  • Owner changed from nbachiyski to westi
  • Severity changed from normal to major
  • Status changed from reopened to assigned

westi, can you sync WordPress pomo with GlotPress?

comment:5 @nbachiyski5 years ago

  • Milestone changed from Unassigned to 3.0

comment:6 @automattor5 years ago

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

(In [13228]) Sync pomo. Props nbachiyski. fixes #11832

Note: See TracTickets for help on using tickets.