Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[HttpKernel] pass CSV escape characters explicitly #58266

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function find(?string $ip, ?string $url, ?int $limit, ?string $method, ?i

$result = [];
while (\count($result) < $limit && $line = $this->readLineFromFile($file)) {
$values = str_getcsv($line);
$values = str_getcsv($line, ',', '"', '\\');

if (7 !== \count($values)) {
// skip invalid lines
Expand Down Expand Up @@ -187,7 +187,7 @@ public function write(Profile $profile): bool
$profile->getTime(),
$profile->getParentToken(),
$profile->getStatusCode(),
]);
], ',', '"', '\\');
fclose($file);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,12 +336,12 @@ public function testMultiRowIndexFile()

$handle = fopen($this->tmpDir.'/index.csv', 'r');
for ($i = 0; $i < $iteration; ++$i) {
$row = fgetcsv($handle);
$row = fgetcsv($handle, null, ',', '"', '\\');
$this->assertEquals('token'.$i, $row[0]);
$this->assertEquals('127.0.0.'.$i, $row[1]);
$this->assertEquals('http://foo.bar/'.$i, $row[3]);
}
$this->assertFalse(fgetcsv($handle));
$this->assertFalse(fgetcsv($handle, null, ',', '"', '\\'));
}

public function testReadLineFromFile()
Expand Down
2 changes: 1 addition & 1 deletion 2 src/Symfony/Component/Translation/Dumper/CsvFileDumper.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function formatCatalogue(MessageCatalogue $messages, string $domain, arra
$handle = fopen('php://memory', 'r+');

foreach ($messages->all($domain) as $source => $target) {
fputcsv($handle, [$source, $target], $this->delimiter, $this->enclosure);
fputcsv($handle, [$source, $target], $this->delimiter, $this->enclosure, '\\');
}

rewind($handle);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ private function readPropertiesFromRegistry(array $properties): array
array_shift($lines);

foreach ($lines as $line) {
$columns = str_getcsv($line, "\t");
$columns = str_getcsv($line, "\t", '"', '\\');
$propertyLabel = array_shift($columns);

if (!isset($properties[$propertyLabel])) {
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.