mirror of
https://codeberg.org/icewind/streams.git
synced 2026-06-03 16:44:07 +02:00
Prevent duplicate closeCallback calls in case of GC ghosts
Sometimes PHP 7 GC decides to call stream_close again even after the PHP request has ended, and even if fclose was called before already.
This commit is contained in:
parent
0700f81441
commit
668abfee80
1 changed files with 2 additions and 0 deletions
|
|
@ -107,6 +107,8 @@ class CallbackWrapper extends Wrapper {
|
|||
$result = parent::stream_close();
|
||||
if (is_callable($this->closeCallback)) {
|
||||
call_user_func($this->closeCallback);
|
||||
// prevent further calls by potential PHP 7 GC ghosts
|
||||
$this->closeCallback = null;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue