diff --git a/src/Symfony/Component/Translation/Loader/CsvFileLoader.php b/src/Symfony/Component/Translation/Loader/CsvFileLoader.php index 9d26611e531b3..2e0d7ee747e29 100644 --- a/src/Symfony/Component/Translation/Loader/CsvFileLoader.php +++ b/src/Symfony/Component/Translation/Loader/CsvFileLoader.php @@ -34,7 +34,7 @@ protected function loadResource(string $resource): array throw new NotFoundResourceException(\sprintf('Error opening file "%s".', $resource), 0, $e); } - $file->setFlags(\SplFileObject::READ_CSV | \SplFileObject::SKIP_EMPTY); + $file->setFlags(\SplFileObject::READ_CSV | \SplFileObject::SKIP_EMPTY | \SplFileObject::DROP_NEW_LINE); $file->setCsvControl($this->delimiter, $this->enclosure, $this->escape); foreach ($file as $data) { diff --git a/src/Symfony/Component/Translation/Tests/Fixtures/resources.csv b/src/Symfony/Component/Translation/Tests/Fixtures/resources.csv index 374b9eb5eb68e..43de5eb500732 100644 --- a/src/Symfony/Component/Translation/Tests/Fixtures/resources.csv +++ b/src/Symfony/Component/Translation/Tests/Fixtures/resources.csv @@ -1,4 +1,6 @@ "foo"; "bar" #"bar"; "foo" + +# all incorrect examples: "incorrect"; "number"; "columns"; "will"; "be"; "ignored" -"incorrect" \ No newline at end of file +"incorrect"