 .../path/src/Plugin/Field/FieldType/PathFieldItemList.php | 13 +++++++++++++
 core/modules/path/src/Plugin/Field/FieldType/PathItem.php |  2 +-
 .../path/src/Plugin/Field/FieldWidget/PathWidget.php      |  2 +-
 core/modules/path/tests/src/Kernel/PathItemTest.php       | 15 +++++++++++++++
 4 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/core/modules/path/src/Plugin/Field/FieldType/PathFieldItemList.php b/core/modules/path/src/Plugin/Field/FieldType/PathFieldItemList.php
index a98e718..2b8a3c3 100644
--- a/core/modules/path/src/Plugin/Field/FieldType/PathFieldItemList.php
+++ b/core/modules/path/src/Plugin/Field/FieldType/PathFieldItemList.php
@@ -59,6 +59,14 @@ public function getIterator() {
   }
 
   /**
+   * {@inheritdoc}
+   */
+  public function count() {
+    $this->ensureLoaded();
+    return parent::count();
+  }
+
+  /**
    * Automatically create the first item for computed fields.
    *
    * This ensures that ::getValue() and ::isEmpty() calls will behave like a
@@ -68,7 +76,12 @@ public function getIterator() {
    */
   protected function ensureLoaded() {
     if (!isset($this->list[0]) && $this->definition->isComputed()) {
+      // Create the first item in the list which will load the computed alias
+      // value if it exists.
       $this->list[0] = $this->createItem(0);
+      // If no alias actually exists remove the empty item. This ensures that
+      // count() will not return 1 for an empty list.
+      $this->filterEmptyItems();
     }
   }
 
diff --git a/core/modules/path/src/Plugin/Field/FieldType/PathItem.php b/core/modules/path/src/Plugin/Field/FieldType/PathItem.php
index 4106381..7115728 100644
--- a/core/modules/path/src/Plugin/Field/FieldType/PathItem.php
+++ b/core/modules/path/src/Plugin/Field/FieldType/PathItem.php
@@ -174,7 +174,7 @@ protected function ensureLoaded() {
         if ($alias) {
           $this->setValue($alias);
         }
-        else {
+        elseif (count($this->values)) {
           // If there is no existing alias, default the langcode to the current
           // language.
           // @todo Set the langcode to not specified for untranslatable fields
diff --git a/core/modules/path/src/Plugin/Field/FieldWidget/PathWidget.php b/core/modules/path/src/Plugin/Field/FieldWidget/PathWidget.php
index 13ab1f1..8d3badf 100644
--- a/core/modules/path/src/Plugin/Field/FieldWidget/PathWidget.php
+++ b/core/modules/path/src/Plugin/Field/FieldWidget/PathWidget.php
@@ -47,7 +47,7 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen
      ];
     $element['langcode'] = [
       '#type' => 'value',
-      '#value' => $items[$delta]->langcode,
+      '#value' => $items[$delta]->langcode ?: $entity->language()->getId(),
     ];
     return $element;
   }
diff --git a/core/modules/path/tests/src/Kernel/PathItemTest.php b/core/modules/path/tests/src/Kernel/PathItemTest.php
index 9a85a27..fba96de 100644
--- a/core/modules/path/tests/src/Kernel/PathItemTest.php
+++ b/core/modules/path/tests/src/Kernel/PathItemTest.php
@@ -49,16 +49,31 @@ public function testPathItem() {
 
     $node_storage = \Drupal::entityTypeManager()->getStorage('node');
 
+    // First test with an entity that doesn't have the path field set.
+    $node = Node::create([
+      'title' => 'Testing no path',
+      'type' => 'foo',
+    ]);
+    $this->assertTrue($node->get('path')->isEmpty());
+    $this->assertEquals(0, count($node->get('path')));
+
+    $node->save();
+    $this->assertTrue($node->get('path')->isEmpty());
+    $this->assertEquals(0, count($node->get('path')));
+
+    // Test with an entity with path field set.
     $node = Node::create([
       'title' => 'Testing create()',
       'type' => 'foo',
       'path' => ['alias' => '/foo'],
     ]);
     $this->assertFalse($node->get('path')->isEmpty());
+    $this->assertEquals(1, count($node->get('path')));
     $this->assertEquals('/foo', $node->get('path')->alias);
 
     $node->save();
     $this->assertFalse($node->get('path')->isEmpty());
+    $this->assertEquals(1, count($node->get('path')));
     $this->assertEquals('/foo', $node->get('path')->alias);
 
     $stored_alias = $alias_storage->lookupPathAlias('/' . $node->toUrl()->getInternalPath(), $node->language()->getId());
