Skip to content

Commit eb780c9

Browse files
authored
fix: notice on empty buffer to flush in StreamTransport (#2)
``` [Application] Mar 21 23:56:01 |CRITICA| REQUES Uncaught PHP Exception ErrorException: "Notice: ob_flush(): Failed to flush buffer. No buffer to flush" at StreamTransport.php line 50 ```
1 parent 90a581a commit eb780c9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Server/Transport/Sse/StreamTransport.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ private function flushEvent(string $event, string $data): void
4747
echo sprintf('event: %s', $event).PHP_EOL;
4848
echo sprintf('data: %s', $data).PHP_EOL;
4949
echo PHP_EOL;
50-
ob_flush();
50+
if (ob_get_length() !== false) {
51+
ob_flush();
52+
}
5153
flush();
5254
}
5355
}

0 commit comments

Comments
 (0)