8000 [Console] fix Component/Console/Output/BufferedOutput buffer memory overflow by wenjy · Pull Request #39159 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Console] fix Component/Console/Output/BufferedOutput buffer memory overflow #39159

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/Symfony/Component/Console/Style/SymfonyStyle.php
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,10 @@ private function writeBuffer(string $message, bool $newLine, int $type): void
{
// We need to know if the two last chars are PHP_EOL
// Preserve the last 4 chars inserted (PHP_EOL on windows is two chars) in the history buffer
$this->bufferedOutput->write(substr($message, -4), $newLine, $type);
$messages = array_map(function ($value) {
return substr($value, -4);
}, array_merge([$this->bufferedOutput->fetch()], (array) $message));
$this->bufferedOutput->write($messages, $newLine, $type);
}

private function createBlock(iterable $messages, string $type = null, string $style = null, string $prefix = ' ', bool $padding = false, bool $escape = false): array
Expand Down
0