Skip to content

Commit 9553afa

Browse files
committed
Merge pull request #53 from jmalloc/closure-this
Change `$this` parameter in closure to `$that` to prevent memory leak.
2 parents ea34298 + 123cd86 commit 9553afa

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/Request.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,12 @@ public function write($data)
9191
}
9292

9393
if (!count($this->pendingWrites)) {
94-
$this->on('headers-written', function ($this) {
95-
foreach ($this->pendingWrites as $pw) {
96-
$this->write($pw);
94+
$this->on('headers-written', function ($that) {
95+
foreach ($that->pendingWrites as $pw) {
96+
$that->write($pw);
9797
}
98-
$this->pendingWrites = array();
99-
$this->emit('drain', array($this));
98+
$that->pendingWrites = array();
99+
$that->emit('drain', array($that));
100100
});
101101
}
102102

0 commit comments

Comments
 (0)