Here is a piece of code from entity_translation_upgrade_do() function:

    $nids = array_keys($result);
    $nodes = node_load_multiple($nids + array_unique($result));

The $result variable here is an array where keys are node IDs and values are translation source node IDs.

Check the following to see a potential bug:

  $result = array(
    '2' => '222',
    '555' => '444',
    '3' => '333',
  );

  // Current implementation:
  $nids = array_keys($result);
  print_r($nids + array_unique($result));
  // Result:
  //  [0] => 2
  //  [1] => 555
  //  [2] => 3
  //  [555] => 444
  //  [3] => 333
  
  // Proposed implementation:
  print_r(array_values(array_unique(array_merge($nids, $result))));
  // Result:
  //  [0] => 2
  //  [1] => 555
  //  [2] => 3
  //  [3] => 222
  //  [4] => 444
  //  [5] => 333
CommentFileSizeAuthor
#1 entity_translation-2530664-1.patch784 bytesLeksat
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Leksat’s picture

Status: Active » Needs review
FileSize
784 bytes
DamienMcKenna’s picture

DamienMcKenna’s picture