8000 minor #18932 Improve memory efficiency (Dword123) · symfony/symfony@a004fc7 · GitHub
[go: up one dir, main page]

Skip to content

Commit a004fc7

Browse files
minor #18932 Improve memory efficiency (Dword123)
This PR was merged into the 2.7 branch. Discussion ---------- Improve memory efficiency | 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 | This avoids concatenating `$message` and `PHP_EOL` (if necessary) as a new value, greatly improving memory efficiency for large `$message`s. Commits ------- c1df9f2 Improve memory efficiency
2 parents 9d79a40 + c1df9f2 commit a004fc7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function getStream()
7070
*/
7171
protected function doWrite($message, $newline)
7272
{
73-
if (false === @fwrite($this->stream, $message.($newline ? PHP_EOL : ''))) {
73+
if (false === @fwrite($this->stream, $message) || ($newline && (false === @fwrite($this->stream, PHP_EOL)))) {
7474
// should never happen
7575
throw new \RuntimeException('Unable to write output.');
7676
}

0 commit comments

Comments
 (0)
0