Skip to content

Commit 031f2ca

Browse files
committed
Fix: prevent fatal error when calling feof after close
1 parent 7b8bb0a commit 031f2ca

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/Server/Response.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -268,15 +268,15 @@ public function sendContent(): static
268268

269269
try {
270270
$this->stream->write($content);
271+
272+
if ($body->eof()) {
273+
$body->close();
274+
$resolve();
275+
}
271276
} catch (Throwable $exception) {
272277
$body->close();
273278
$reject($exception);
274279
}
275-
276-
if ($body->eof()) {
277-
$body->close();
278-
$resolve();
279-
}
280280
});
281281
})->await();
282282
} elseif ($this->body instanceof Generator) {

0 commit comments

Comments
 (0)