mirror of
https://github.com/nextcloud/server.git
synced 2026-06-14 19:20:35 -04:00
handle cases where the hash context gets cleaned up before the hash wrapper
Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
parent
f56ecf9242
commit
a9575a7029
1 changed files with 5 additions and 1 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue