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

Skip to content

[Translation] Fix handling of empty lines in CsvFileLoader#63064

Merged
nicolas-grekas merged 1 commit into
symfony:6.4from
fnogatz:fix-handling-of-empty-lines-in-CsvFileLoader
Jan 12, 2026
Merged

[Translation] Fix handling of empty lines in CsvFileLoader#63064
nicolas-grekas merged 1 commit into
symfony:6.4from
fnogatz:fix-handling-of-empty-lines-in-CsvFileLoader

Conversation

@fnogatz
Copy link
Copy Markdown
Contributor

@fnogatz fnogatz commented Jan 12, 2026

Q A
Branch? 6.4
Bug fix? yes
New feature? no
Deprecations? no
Issues (none)
License MIT

In its current version, the CsvFileLoader of symfony/translation does not support empty lines within the CSV file due to a missing SplFileObject::DROP_NEW_LINE flag (cf. PHP documentation). Without this change, this would result in a warning like this:

CsvFileLoader.php:44
str_starts_with(): Passing null to parameter #1 ($haystack) of type string is deprecated

This PR changes the test file resources.csv to contain an empty line, and adds the missing flag in CsvFileLoader::loadResource(). I'm not sure whether this should be handled as a bugfix or new feature. Adding the flag doesn't break backward compatibility.

@fnogatz fnogatz requested a review from welcoMattic as a code owner January 12, 2026 18:41
@carsonbot carsonbot added this to the 8.1 milestone Jan 12, 2026
@carsonbot carsonbot changed the title Fix handling of empty lines in CsvFileLoader Fix handling of empty lines in CsvFileLoader Jan 12, 2026
@carsonbot carsonbot changed the title Fix handling of empty lines in CsvFileLoader [Translation] Fix handling of empty lines in CsvFileLoader Jan 12, 2026
@nicolas-grekas nicolas-grekas changed the base branch from 8.1 to 6.4 January 12, 2026 19:15
@nicolas-grekas nicolas-grekas force-pushed the fix-handling-of-empty-lines-in-CsvFileLoader branch from 1dd8bba to 61a1414 Compare January 12, 2026 19:15
@nicolas-grekas
Copy link
Copy Markdown
Member

Thank you @fnogatz.

@nicolas-grekas nicolas-grekas merged commit 1fd5a2c into symfony:6.4 Jan 12, 2026
This was referenced Jan 24, 2026
@fabpot fabpot mentioned this pull request Jan 25, 2026
@fnogatz fnogatz deleted the fix-handling-of-empty-lines-in-CsvFileLoader branch April 7, 2026 21:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants