diff --git a/core/modules/comment/src/Plugin/migrate/source/d7/Comment.php b/core/modules/comment/src/Plugin/migrate/source/d7/Comment.php index 73c2d8f4f7..d5b9a11ac2 100644 --- a/core/modules/comment/src/Plugin/migrate/source/d7/Comment.php +++ b/core/modules/comment/src/Plugin/migrate/source/d7/Comment.php @@ -2,6 +2,7 @@ namespace Drupal\comment\Plugin\migrate\source\d7; +use Drupal\Core\Language\LanguageInterface; use Drupal\migrate\Row; use Drupal\migrate_drupal\Plugin\migrate\source\d7\FieldableEntity; @@ -44,6 +45,12 @@ public function prepareRow(Row $row) { $source_language = $this->getEntityTranslationSourceLanguage('comment', $cid); $language = $entity_translatable && $source_language ? $source_language : $row->getSourceProperty('language'); + // If this comment was upgraded from Drupal 6 or older, it's possible that + // no language code was specified. + if (!$row->getSourceProperty('language')) { + $row->setSourceProperty('language', LanguageInterface::LANGCODE_NOT_SPECIFIED); + } + // Get Field API field values. foreach ($this->getFields('comment', $comment_type) as $field_name => $field) { // Ensure we're using the right language if the entity and the field are