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

Commit 8c32db3

Browse filesBrowse files
committed
pass CSV escape characters explicitly
Not passing the $escape parameter is deprecated since PHP 8.4 as the default value will change in the future.
1 parent de845c2 commit 8c32db3
Copy full SHA for 8c32db3

File tree

4 files changed

+6
-6
lines changed
Filter options

4 files changed

+6
-6
lines changed

‎src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function find(?string $ip, ?string $url, ?int $limit, ?string $method, ?i
6060

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

6565
if (7 !== \count($values)) {
6666
// skip invalid lines
@@ -187,7 +187,7 @@ public function write(Profile $profile): bool
187187
$profile->getTime(),
188188
$profile->getParentToken(),
189189
$profile->getStatusCode(),
190-
]);
190+
], ',', '"', '\\');
191191
fclose($file);
192192
}
193193

‎src/Symfony/Component/HttpKernel/Tests/Profiler/FileProfilerStorageTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/Tests/Profiler/FileProfilerStorageTest.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,12 +336,12 @@ public function testMultiRowIndexFile()
336336

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

347347
public function testReadLineFromFile()

‎src/Symfony/Component/Translation/Dumper/CsvFileDumper.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Translation/Dumper/CsvFileDumper.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function formatCatalogue(MessageCatalogue $messages, string $domain, arra
3131
$handle = fopen('php://memory', 'r+');
3232

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

3737
rewind($handle);

‎src/Symfony/Component/Validator/Resources/bin/sync-iban-formats.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Resources/bin/sync-iban-formats.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ private function readPropertiesFromRegistry(array $properties): array
129129
array_shift($lines);
130130

131131
foreach ($lines as $line) {
132-
$columns = str_getcsv($line, "\t");
132+
$columns = str_getcsv($line, "\t", '"', '\\');
133133
$propertyLabel = array_shift($columns);
134134

135135
if (!isset($properties[$propertyLabel])) {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.