google_tag_post_update_move_advanced_settings causes Undefined variable warning

Created on 31 August 2024, 4 months ago

The google_tag_post_update_move_advanced_settings function causes
[warning] Undefined variable $advanced_settings google_tag.post_update.php:19

This is because in the code:

foreach ($google_tags as $tag_container) {
    $gtm_tags = $tag_container->getGtmIds();
    foreach ($gtm_tags as $tag) {
      $advanced_settings['gtm'][$tag] = $tag_container->getGtmSettings();
    }
    $tag_container->set('advanced_settings', $advanced_settings);
    $tag_container->save();
  }

If the inner foreach for some reason does not have any iteration, then the $advanced_settings does not exist.

🐛 Bug report
Status

Needs review

Version

2.0

Component

Code

Created by

🇭🇺Hungary nagy.balint

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024