Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment | File | Size | Author |
---|---|---|---|
#1 | entity_translation-2530664-1.patch | 784 bytes | Leksat |
Comments
Comment #1
Leksat CreditAttribution: Leksat at Amazee Labs commentedComment #2
DamienMcKennaComment #3
DamienMcKenna