]> source.dussan.org Git - nextcloud-server.git/commitdiff
handle errors from hash_final 33863/head
authorRobin Appelman <robin@icewind.nl>
Fri, 2 Sep 2022 10:27:13 +0000 (12:27 +0200)
committerRobin Appelman <robin@icewind.nl>
Fri, 2 Sep 2022 10:27:13 +0000 (12:27 +0200)
Signed-off-by: Robin Appelman <robin@icewind.nl>
lib/private/Files/Stream/HashWrapper.php

index b2bfcff68d4bab475103a65886e49d77db24a25d..4060d74de7dcc1f164628ed84f558afacf2cf167 100644 (file)
@@ -69,8 +69,13 @@ class HashWrapper extends Wrapper {
                if (is_callable($this->callback)) {
                        // if the stream is closed as a result of the end-of-request GC, the hash context might be cleaned up before this stream
                        if ($this->hash instanceof \HashContext) {
-                               $hash = hash_final($this->hash);
-                               call_user_func($this->callback, $hash);
+                               try {
+                                       $hash = @hash_final($this->hash);
+                                       if ($hash) {
+                                               call_user_func($this->callback, $hash);
+                                       }
+                               } catch (\Throwable $e) {
+                               }
                        }
                        // prevent further calls by potential PHP 7 GC ghosts
                        $this->callback = null;