Commit 3bce21cf authored by catch's avatar catch
Browse files

fix: #3557174 Fix use of NULL as array key in...

fix: #3557174 Fix use of NULL as array key in \Drupal\user\Plugin\migrate\process\d6\UserUpdate7002::transform() triggers deprecations on PHP 8.5

By: @alexpott
parent 8d250265
Loading
Loading
Loading
Loading
Loading
+2 −13
Original line number Diff line number Diff line
@@ -58,20 +58,9 @@ public static function create(ContainerInterface $container, array $configuratio
   * {@inheritdoc}
   */
  public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
    $timezone = NULL;
    $timezone = $row->getSourceProperty('timezone_name') ?? $row->getSourceProperty('event_timezone');

    if ($row->hasSourceProperty('timezone_name')) {
      if (isset(static::$timezones[$row->getSourceProperty('timezone_name')])) {
        $timezone = $row->getSourceProperty('timezone_name');
      }
    }
    if (!$timezone && $row->hasSourceProperty('event_timezone')) {
      if (isset(static::$timezones[$row->getSourceProperty('event_timezone')])) {
        $timezone = $row->getSourceProperty('event_timezone');
      }
    }

    if ($timezone === NULL) {
    if ($timezone === NULL || !isset(static::$timezones[$timezone])) {
      $timezone = $this->dateConfig->get('timezone.default');
    }
    return $timezone;