Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/private/Files/Stream/HashWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,11 @@ public function stream_read($count) {

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;
}
Expand Down