Commit 818d7fd8 authored by Adam Bramley's avatar Adam Bramley Committed by Damien McKenna
Browse files

Issue #3255731 by acbramley, DamienMcKenna, tim.anderson: Undefined array key...

Issue #3255731 by acbramley, DamienMcKenna, tim.anderson: Undefined array key errors from metatag_update_8109.
parent 0347ce5b
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -5,6 +5,8 @@ Metatag 8.x-1.x-dev, 2022-xx-xx
#3255547 by Eugene Bocharov, Thomas Kaisuka, Stephen Ollman, glynster, oxy86,
  Matthijs, Mahmoud Barhouma, DamienMcKenna, wells: View preview broken after
  Metatag upgrade.
#3255731 by acbramley, DamienMcKenna, tim.anderson: Undefined array key errors
  from metatag_update_8109.


Metatag 8.x-1.18, 2021-12-21
+26 −18
Original line number Diff line number Diff line
@@ -124,6 +124,10 @@ function metatag_update_8109(&$sandbox) {
        $result = $query->execute();
        $records = $result->fetchAll();

        if (empty($records)) {
          continue;
        }

        // Fill in all the sandbox information so we can batch the individual
        // record comparing and updating.
        $sandbox['fields'][$field_counter]['field_table'] = $field_table;
@@ -153,7 +157,10 @@ function metatag_update_8109(&$sandbox) {
    $field_value_field = $sandbox['fields'][$current_field]['field_value_field'];

    // Loop through the field(s) and update the mask_icon values if necessary.
    while ($counter <= $max_per_batch && $record = $current_field_records[$current_record]) {
    while ($counter <= $max_per_batch) {
      if (isset($current_field_records[$current_record])) {
        $record = $current_field_records[$current_record];

        // Strip any empty tags or ones matching the field's defaults and leave
        // only the overridden tags in $new_tags.
        $tags = unserialize($record->$field_value_field);
@@ -172,6 +179,7 @@ function metatag_update_8109(&$sandbox) {
            ->condition('langcode', $record->langcode)
            ->execute();
        }
      }

      $counter++;
      $current_record++;