更新
This commit is contained in:
@@ -950,7 +950,9 @@ class DifyChatService
|
||||
bool $final = false
|
||||
): void {
|
||||
$buffer .= $chunk;
|
||||
while (preg_match('/(?:\r\n|\r|\n){2}/', $buffer, $match, PREG_OFFSET_CAPTURE) === 1) {
|
||||
// Keep CRLF atomic: otherwise regex backtracking can count a single CRLF
|
||||
// as two line breaks and decode a multi-line event before it is complete.
|
||||
while (preg_match('/(?>\r\n|\r|\n){2}/', $buffer, $match, PREG_OFFSET_CAPTURE) === 1) {
|
||||
$delimiter = $match[0][0];
|
||||
$offset = $match[0][1];
|
||||
$frame = substr($buffer, 0, $offset);
|
||||
|
||||
Reference in New Issue
Block a user