From 51166f11f4ffa15ab2207143dc5acbd893670709 Mon Sep 17 00:00:00 2001
From: catch <catch@35733.no-reply.drupal.org>
Date: Tue, 28 Sep 2021 17:19:52 +0100
Subject: [PATCH] Issue #3239552 by andypost, alexpott, daffie: Improve hash()
 calculation for PHP 8.1

---
 core/modules/aggregator/src/ItemsImporter.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/core/modules/aggregator/src/ItemsImporter.php b/core/modules/aggregator/src/ItemsImporter.php
index 156c7fb4823d..ef0e3cd87c0e 100644
--- a/core/modules/aggregator/src/ItemsImporter.php
+++ b/core/modules/aggregator/src/ItemsImporter.php
@@ -108,7 +108,7 @@ public function refresh(FeedInterface $feed) {
     // We store the hash of feed data in the database. When refreshing a
     // feed we compare stored hash and new hash calculated from downloaded
     // data. If both are equal we say that feed is not updated.
-    $hash = hash('sha256', $feed->source_string);
+    $hash = $success ? hash('sha256', $feed->source_string) : '';
     $has_new_content = $success && ($feed->getHash() != $hash);
 
     if ($has_new_content) {
-- 
GitLab