diff --git a/core/modules/hal/src/Normalizer/EntityReferenceItemNormalizer.php b/core/modules/hal/src/Normalizer/EntityReferenceItemNormalizer.php
index 44ba17104425a3e8d9390f884e29c4305ae63a97..f57873455609f89ba93ef07218e34e1627a70209 100644
--- a/core/modules/hal/src/Normalizer/EntityReferenceItemNormalizer.php
+++ b/core/modules/hal/src/Normalizer/EntityReferenceItemNormalizer.php
@@ -103,7 +103,8 @@ protected function constructValue($data, $context) {
     $field_item = $context['target_instance'];
     $field_definition = $field_item->getFieldDefinition();
     $target_type = $field_definition->getSetting('target_type');
-    if ($id = $this->entityResolver->resolve($this, $data, $target_type)) {
+    $id = $this->entityResolver->resolve($this, $data, $target_type);
+    if (isset($id)) {
       return array('target_id' => $id);
     }
     return NULL;
diff --git a/core/modules/serialization/src/EntityResolver/ChainEntityResolver.php b/core/modules/serialization/src/EntityResolver/ChainEntityResolver.php
index e1291c1d286cd4fa6f5e6d22520cadf86cc1419b..af105574f8134a3b86f77b87384bf1a0bf13bc1b 100644
--- a/core/modules/serialization/src/EntityResolver/ChainEntityResolver.php
+++ b/core/modules/serialization/src/EntityResolver/ChainEntityResolver.php
@@ -43,7 +43,8 @@ public function addResolver(EntityResolverInterface $resolver) {
    */
   public function resolve(NormalizerInterface $normalizer, $data, $entity_type) {
     foreach ($this->resolvers as $resolver) {
-      if ($resolved = $resolver->resolve($normalizer, $data, $entity_type)) {
+      $resolved = $resolver->resolve($normalizer, $data, $entity_type);
+      if (isset($resolved)) {
         return $resolved;
       }
     }
diff --git a/core/modules/serialization/tests/src/Unit/EntityResolver/ChainEntityResolverTest.php b/core/modules/serialization/tests/src/Unit/EntityResolver/ChainEntityResolverTest.php
index 64d8ca6d961f291e6765748b445f3592fd83c37c..22cffacd7d3794b79693e228aa51c5615d11ed3b 100644
--- a/core/modules/serialization/tests/src/Unit/EntityResolver/ChainEntityResolverTest.php
+++ b/core/modules/serialization/tests/src/Unit/EntityResolver/ChainEntityResolverTest.php
@@ -110,6 +110,23 @@ public function testResolverWithLastResolved() {
     $this->assertSame(10, $resolver->resolve($this->testNormalizer, $this->testData, $this->testEntityType));
   }
 
+  /**
+   * Test the resolve method where one resolver returns 0.
+   *
+   * @covers ::__construct
+   * @covers ::resolve
+   */
+  public function testResolverWithResolvedToZero() {
+    $resolvers = array(
+      $this->createEntityResolverMock(0),
+      $this->createEntityResolverMock(NULL, FALSE),
+    );
+
+    $resolver = new ChainEntityResolver($resolvers);
+
+    $this->assertSame(0, $resolver->resolve($this->testNormalizer, $this->testData, $this->testEntityType));
+  }
+
   /**
    * Creates a mock entity resolver.
    *