Skip to content

Commit a83b39c

Browse files
[Translation] Fix CSV escape char in CsvFileLoader on PHP >= 7.4
1 parent 4a176ce commit a83b39c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Symfony/Component/Translation/Loader/CsvFileLoader.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class CsvFileLoader extends FileLoader
2222
{
2323
private $delimiter = ';';
2424
private $enclosure = '"';
25-
private $escape = '\\';
25+
private $escape = '';
2626

2727
/**
2828
* {@inheritdoc}
@@ -56,10 +56,10 @@ protected function loadResource(string $resource)
5656
/**
5757
* Sets the delimiter, enclosure, and escape character for CSV.
5858
*/
59-
public function setCsvControl(string $delimiter = ';', string $enclosure = '"', string $escape = '\\')
59+
public function setCsvControl(string $delimiter = ';', string $enclosure = '"', string $escape = '')
6060
{
6161
$this->delimiter = $delimiter;
6262
$this->enclosure = $enclosure;
63-
$this->escape = $escape;
63+
$this->escape = '' === $escape && \PHP_VERSION_ID < 70400 ? '\\' : $escape;
6464
}
6565
}

0 commit comments

Comments
 (0)