Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6852327

Browse files
minor #36689 [Yaml] properly handle empty lines (xabbuh)
This PR was merged into the 5.1-dev branch. Discussion ---------- [Yaml] properly handle empty lines | Q | A | ------------- | --- | Branch? | master | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | | License | MIT | Doc PR | Commits ------- e91bb61 properly handle empty lines
2 parents ca1d4b4 + e91bb61 commit 6852327

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Symfony/Component/Yaml/Parser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -969,7 +969,7 @@ private function isCurrentLineBlank(): bool
969969
private function isCurrentLineComment(): bool
970970
{
971971
//checking explicitly the first char of the trim is faster than loops or strpos
972-
$ltrimmedLine = ' ' === $this->currentLine[0] ? ltrim($this->currentLine, ' ') : $this->currentLine;
972+
$ltrimmedLine = '' !== $this->currentLine && ' ' === $this->currentLine[0] ? ltrim($this->currentLine, ' ') : $this->currentLine;
973973

974974
return '' !== $ltrimmedLine && '#' === $ltrimmedLine[0];
975975
}

0 commit comments

Comments
 (0)