mirror of
https://codeberg.org/icewind/streams.git
synced 2026-06-03 16:44:07 +02:00
Merge pull request #5 from PVince81/stream_close_scare_away_ghosts
Prevent duplicate closeCallback calls in case of GC ghosts
This commit is contained in:
commit
6bfd2fdbd9
1 changed files with 2 additions and 0 deletions
|
|
@ -107,6 +107,8 @@ class CallbackWrapper extends Wrapper {
|
||||||
$result = parent::stream_close();
|
$result = parent::stream_close();
|
||||||
if (is_callable($this->closeCallback)) {
|
if (is_callable($this->closeCallback)) {
|
||||||
call_user_func($this->closeCallback);
|
call_user_func($this->closeCallback);
|
||||||
|
// prevent further calls by potential PHP 7 GC ghosts
|
||||||
|
$this->closeCallback = null;
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue