Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorVincent Petry <vincent@nextcloud.com>2022-09-01 14:23:19 +0300
committerGitHub <noreply@github.com>2022-09-01 14:23:19 +0300
commit7ea84277f886a1f59a80011ccdb80c71a2105c18 (patch)
tree96e044b3e55ca1fc558a4556a96ebcdae550089d /lib
parentaffa402d2106d9d8f7ec4cc28b79a388c18ec660 (diff)
parenta9575a7029f21226ef2f8372be4f7e433e6a59fa (diff)
Merge pull request #33774 from nextcloud/hash-wrapper-closed-hash
handle cases where the hash context gets cleaned up before the hash wrapper
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Files/Stream/HashWrapper.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/private/Files/Stream/HashWrapper.php b/lib/private/Files/Stream/HashWrapper.php
index fd9bb3cdd0b..b2bfcff68d4 100644
--- a/lib/private/Files/Stream/HashWrapper.php
+++ b/lib/private/Files/Stream/HashWrapper.php
@@ -67,7 +67,11 @@ class HashWrapper extends Wrapper {
public function stream_close() {
if (is_callable($this->callback)) {
- call_user_func($this->callback, hash_final($this->hash));
+ // 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);
+ }
// prevent further calls by potential PHP 7 GC ghosts
$this->callback = null;
}