8000 Merge branch '7.1' into 7.2 · symfony/symfony@0e1d3b5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0e1d3b5

Browse files
committed
Merge branch '7.1' into 7.2
* 7.1: fix merge pass CSV escape characters explicitly move setting deprecation session options into a legacy group test
2 parents d575fa5 + fe822c5 commit 0e1d3b5

File tree

5 files changed

+30
-10
lines changed

5 files changed

+30
-10
lines changed

src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,19 +203,39 @@ public function testCookieOptions()
203203
$this->assertEquals($options, $gco);
204204
}
205205

206-
public function testSessionOptions()
206+
public function testCacheExpireOption()
207207
{
208208
$options = [
209-
'trans_sid_tags' => 'a=href',
210209
'cache_expire' => '200',
211210
];
212211

213212
$this->getStorage($options);
214213

215-
$this->assertSame('a=href', \ini_get('session.trans_sid_tags'));
216214
$this->assertSame('200', \ini_get('session.cache_expire'));
217215
}
218216

217+
/**
218+
* The test must only be removed when the "session.trans_sid_tags" option is removed from PHP or when the "trans_sid_tags" option is no longer supported by the native session storage.
219+
*/
220+
public function testTransSidTagsOption()
221+
{
222+
$previousErrorHandler = set_error_handler(function ($errno, $errstr) use (&$previousErrorHandler) {
223+
if ('ini_set(): Usage of session.trans_sid_tags INI setting is deprecated' !== $errstr) {
224+
return $previousErrorHandler ? $previousErrorHandler(...\func_get_args()) : false;
225+
}
226+
});
227+
228+
try {
229+
$this->getStorage([
230+
'trans_sid_tags' => 'a=href',
231+
]);
232+
} finally {
233+
restore_error_handler();
234+
}
235+
236+
$this->assertSame('a=href', \ini_get('session.trans_sid_tags'));
237+
}
238+
219239
public function testSetSaveHandler()
220240
{
221241
$initialSaveHandler = ini_set('session.save_handler', 'files');

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function find(?string $ip, ?string $url, ?int $limit, ?string $method, ?i
5555

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

6060
if (7 > \count($values)) {
6161
// skip invalid lines
@@ -186,7 +186,7 @@ public function write(Profile $profile): bool
186186
$profile->getParentToken(),
187187
$profile->getStatusCode(),
188188
$profile->getVirtualType() ?? 'request',
189-
]);
189+
], ',', '"', '\\');
190190
fclose($file);
191191

192192
if (1 === mt_rand(1, 10)) {
@@ -324,7 +324,7 @@ private function removeExpiredProfiles(): void
324324
}
325325

326326
while ($line = fgets($handle)) {
327-
$values = str_getcsv($line);
327+
$values = str_getcsv($line, ',', '"', '\\');
328328

329329
if (7 > \count($values)) {
330330
// skip invalid lines

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,12 +343,12 @@ public function testMultiRowIndexFile()
343343

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

354354
/**

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function formatCatalogue(MessageCatalogue $messages, string $domain, arra
2828
$handle = fopen('php://memory', 'r+');
2929

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

3434
rewind($handle);

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

Lines 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