Skip to content

Component/Console/Output/BufferedOutput buffer memory overflow #39156

@wenjy

Description

@wenjy

protected function doWrite(string $message, bool $newline)

see laravel issue: laravel/framework#35340

Steps To Reproduce:

use Symfony\Component\Console\Input\StringInput;
use Symfony\Component\Console\Output\ConsoleOutput;
use Symfony\Component\Console\Style\SymfonyStyle;

include __DIR__ . "/../vendor/autoload.php";

$input = new StringInput('test');
$output = new ConsoleOutput();

$style = new SymfonyStyle($input, $output);

$str = 'teststr';
$num = 26843546;//(128 << 20) / 5; "tstr\r\n"  php memory 128M

for ($i =0;$i<$num;$i++) {
    $style->writeln($str);
}

echo 'success';

PR: #26863

Need to call bufferedOutput->fetch

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions