Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handle errors from hash_final #33863

Merged
merged 1 commit into from
Sep 2, 2022
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
9 changes: 7 additions & 2 deletions lib/private/Files/Stream/HashWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,13 @@ public function stream_close() {
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;
Expand Down