diff options
author | blizzz <blizzz@arthur-schiwon.de> | 2022-09-02 22:51:39 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-02 22:51:39 +0200 |
commit | f0b12b450f37da5a6b93779b379cf9ae230217e6 (patch) | |
tree | c9dba4060a5edf12c3e1fedc2b0612b1b78139d0 | |
parent | 16e696c9e864b7a2a860b8f0147aa54c681e7cb8 (diff) | |
parent | 9f5f970957bd729f8773f07c86122873efdf9d9f (diff) | |
download | nextcloud-server-f0b12b450f37da5a6b93779b379cf9ae230217e6.tar.gz nextcloud-server-f0b12b450f37da5a6b93779b379cf9ae230217e6.zip |
Merge pull request #33863 from nextcloud/hash-wrapper-catch-errors
handle errors from hash_final
-rw-r--r-- | lib/private/Files/Stream/HashWrapper.php | 9 |
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; |