aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Files
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2022-09-02 12:27:13 +0200
committerRobin Appelman <robin@icewind.nl>2022-09-02 12:27:13 +0200
commit9f5f970957bd729f8773f07c86122873efdf9d9f (patch)
treeface2aff64ffbef43579c86fd80898a3a2d47f1a /lib/private/Files
parentb1be4346cdf583864188e47055c3b1f336ad5587 (diff)
downloadnextcloud-server-9f5f970957bd729f8773f07c86122873efdf9d9f.tar.gz
nextcloud-server-9f5f970957bd729f8773f07c86122873efdf9d9f.zip
handle errors from hash_final
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib/private/Files')
-rw-r--r--lib/private/Files/Stream/HashWrapper.php9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/private/Files/Stream/HashWrapper.php b/lib/private/Files/Stream/HashWrapper.php
index b2bfcff68d4..4060d74de7d 100644
--- a/lib/private/Files/Stream/HashWrapper.php
+++ b/lib/private/Files/Stream/HashWrapper.php
@@ -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;