8000 bug #21981 [Console] Use proper line endings in BufferedOutput (julie… · symfony/symfony@26198cf · GitHub
[go: up one dir, main page]

Skip to content

Commit 26198cf

Browse files
committed
bug #21981 [Console] Use proper line endings in BufferedOutput (julienfalque)
This PR was merged into the 2.7 branch. Discussion ---------- [Console] Use proper line endings in BufferedOutput | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - `BufferOutput` should be consistent with `StreamOutput` when writing newlines. I faced an issue using this class in tests where the expected output was platform dependent (using `PHP_EOL` too). Commits ------- 33946e6 Use proper line endings
2 parents 71b2c3a + 33946e6 commit 26198cf

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/Symfony/Component/Console/Output/BufferedOutput.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ protected function doWrite($message, $newline)
4242
$this->buffer .= $message;
4343

4444
if ($newline) {
45-
$this->buffer .= "\n";
45+
$this->buffer .= PHP_EOL;
4646
}
4747
}
4848
}

src/Symfony/Component/Console/Tests/Fixtures/DummyOutput.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class DummyOutput extends BufferedOutput
2626
public function getLogs()
2727
{
2828
$logs = array();
29-
foreach (explode("\n", trim($this->fetch())) as $message) {
29+
foreach (explode(PHP_EOL, trim($this->fetch())) as $message) {
3030
preg_match('/^\[(.*)\] (.*)/', $message, $matches);
3131
$logs[] = sprintf('%s %s', $matches[1], $matches[2]);
3232
}

0 commit comments

Comments
 (0)
0