Skip to content

Commit 9a1a42e

Browse files
committed
Merge branch '6.3' into 6.4
* 6.3: fix tests Remove full DSNs from exception messages [Yaml] Fix uid binary parsing Disable the "Copy as cURL" button when the debug info are disabled [HttpClient] Replace `escapeshellarg` to prevent overpassing `ARG_MAX` [HttpKernel] Preventing error 500 when function putenv is disabled [PasswordHasher][Tests] Do not invoke methods with additional arguments in tests remove invalid group Fix block scalar array parsing
2 parents c3f0a10 + 01efac5 commit 9a1a42e

File tree

11 files changed

+120
-100
lines changed

11 files changed

+120
-100
lines changed

src/Symfony/Component/Form/Tests/Resources/TranslationFilesTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ public function testTranslationFileIsValid($filePath)
3131

3232
/**
3333
* @dataProvider provideTranslationFiles
34-
*
35-
* @group Legacy
3634
*/
3735
public function testTranslationFileIsValidWithoutEntityLoader($filePath)
3836
{

src/Symfony/Component/HttpClient/DataCollector/HttpClientDataCollector.php

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Symfony\Component\HttpFoundation\Response;
1818
use Symfony\Component\HttpKernel\DataCollector\DataCollector;
1919
use Symfony\Component\HttpKernel\DataCollector\LateDataCollectorInterface;
20+
use Symfony\Component\Process\Process;
2021
use Symfony\Component\VarDumper\Caster\ImgStub;
2122

2223
/**
@@ -193,27 +194,14 @@ private function getCurlCommand(array $trace): ?string
193194
$dataArg = [];
194195

195196
if ($json = $trace['options']['json'] ?? null) {
196-
if (!$this->argMaxLengthIsSafe($payload = self::jsonEncode($json))) {
197-
return null;
198-
}
199-
$dataArg[] = '--data '.escapeshellarg($payload);
197+
$dataArg[] = '--data-raw '.$this->escapePayload(self::jsonEncode($json));
200198
} elseif ($body = $trace['options']['body'] ?? null) {
201199
if (\is_string($body)) {
202-
if (!$this->argMaxLengthIsSafe($body)) {
203-
return null;
204-
}
205-
try {
206-
$dataArg[] = '--data '.escapeshellarg($body);
207-
} catch (\ValueError) {
208-
return null;
209-
}
200+
$dataArg[] = '--data-raw '.$this->escapePayload($body);
210201
} elseif (\is_array($body)) {
211202
$body = explode('&', self::normalizeBody($body));
212203
foreach ($body as $value) {
213-
if (!$this->argMaxLengthIsSafe($payload = urldecode($value))) {
214-
return null;
215-
}
216-
$dataArg[] = '--data '.escapeshellarg($payload);
204+
$dataArg[] = '--data-raw '.$this->escapePayload(urldecode($value));
217205
}
218206
} else {
219207
return null;
@@ -230,6 +218,11 @@ private function getCurlCommand(array $trace): ?string
230218
break;
231219
}
232220

221+
if (str_starts_with('Due to a bug in curl ', $line)) {
222+
// When the curl client disables debug info due to a curl bug, we cannot build the command.
223+
return null;
224+
}
225+
233226
if ('' === $line || preg_match('/^[*<]|(Host: )/', $line)) {
234227
continue;
235228
}
@@ -250,13 +243,18 @@ private function getCurlCommand(array $trace): ?string
250243
return implode(" \\\n ", $command);
251244
}
252245

253-
/**
254-
* Let's be defensive : we authorize only size of 8kio on Windows for escapeshellarg() argument to avoid a fatal error.
255-
*
256-
* @see https://github.com/php/php-src/blob/9458f5f2c8a8e3d6c65cc181747a5a75654b7c6e/ext/standard/exec.c#L397
257-
*/
258-
private function argMaxLengthIsSafe(string $payload): bool
246+
private function escapePayload(string $payload): string
259247
{
260-
return \strlen($payload) < ('\\' === \DIRECTORY_SEPARATOR ? 8100 : 256000);
248+
static $useProcess;
249+
250+
if ($useProcess ??= class_exists(Process::class)) {
251+
return (new Process([$payload]))->getCommandLine();
252+
}
253+
254+
if ('\\' === \DIRECTORY_SEPARATOR) {
255+
return '"'.str_replace('"', '""', $payload).'"';
256+
}
257+
258+
return "'".str_replace("'", "'\\''", $payload)."'";
261259
}
262260
}

src/Symfony/Component/HttpClient/Tests/DataCollector/HttpClientDataCollectorTest.php

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ public static function provideCurlRequests(): iterable
248248
--header %1$sContent-Type: application/x-www-form-urlencoded%1$s \\
249249
--header %1$sAccept-Encoding: gzip%1$s \\
250250
--header %1$sUser-Agent: Symfony HttpClient (Native)%1$s \\
251-
--data %1$sfoobarbaz%1$s',
251+
--data-raw %1$sfoobarbaz%1$s',
252252
];
253253
yield 'POST with array body' => [
254254
[
@@ -286,7 +286,7 @@ public function __toString(): string
286286
--header %1$sContent-Length: 211%1$s \\
287287
--header %1$sAccept-Encoding: gzip%1$s \\
288288
--header %1$sUser-Agent: Symfony HttpClient (Native)%1$s \\
289-
--data %1$sfoo=fooval%1$s --data %1$sbar=barval%1$s --data %1$sbaz=bazval%1$s --data %1$sfoobar[baz]=bazval%1$s --data %1$sfoobar[qux]=quxval%1$s --data %1$sbazqux[0]=bazquxval1%1$s --data %1$sbazqux[1]=bazquxval2%1$s --data %1$sobject[fooprop]=foopropval%1$s --data %1$sobject[barprop]=barpropval%1$s --data %1$stostring=tostringval%1$s',
289+
--data-raw %1$sfoo=fooval%1$s --data-raw %1$sbar=barval%1$s --data-raw %1$sbaz=bazval%1$s --data-raw %1$sfoobar[baz]=bazval%1$s --data-raw %1$sfoobar[qux]=quxval%1$s --data-raw %1$sbazqux[0]=bazquxval1%1$s --data-raw %1$sbazqux[1]=bazquxval2%1$s --data-raw %1$sobject[fooprop]=foopropval%1$s --data-raw %1$sobject[barprop]=barpropval%1$s --data-raw %1$stostring=tostringval%1$s',
290290
];
291291

292292
// escapeshellarg on Windows replaces double quotes & percent signs with spaces
@@ -337,7 +337,7 @@ public function __toString(): string
337337
--header %1$sContent-Length: 120%1$s \\
338338
--header %1$sAccept-Encoding: gzip%1$s \\
339339
--header %1$sUser-Agent: Symfony HttpClient (Native)%1$s \\
340-
--data %1$s{"foo":{"bar":"baz","qux":[1.1,1.0],"fred":["\u003Cfoo\u003E","\u0027bar\u0027","\u0022baz\u0022","\u0026blong\u0026"]}}%1$s',
340+
--data-raw %1$s{"foo":{"bar":"baz","qux":[1.1,1.0],"fred":["\u003Cfoo\u003E","\u0027bar\u0027","\u0022baz\u0022","\u0026blong\u0026"]}}%1$s',
341341
];
342342
}
343343
}
@@ -397,29 +397,7 @@ public function testItDoesNotGeneratesCurlCommandsForUnsupportedBodyType()
397397
/**
398398
* @requires extension openssl
399399
*/
400-
public function testItDoesNotGeneratesCurlCommandsForNotEncodableBody()
401-
{
402-
$sut = new HttpClientDataCollector();
403-
$sut->registerClient('http_client', $this->httpClientThatHasTracedRequests([
404-
[
405-
'method' => 'POST',
406-
'url' => 'http://localhost:8057/json',
407-
'options' => [
408-
'body' => "\0",
409-
],
410-
],
411-
]));
412-
$sut->lateCollect();
413-
$collectedData = $sut->getClients();
414-
self::assertCount(1, $collectedData['http_client']['traces']);
415-
$curlCommand = $collectedData['http_client']['traces'][0]['curlCommand'];
416-
self::assertNull($curlCommand);
417-
}
418-
419-
/**
420-
* @requires extension openssl
421-
*/
422-
public function testItDoesNotGeneratesCurlCommandsForTooBigData()
400+
public function testItDoesGenerateCurlCommandsForBigData()
423401
{
424402
$sut = new HttpClientDataCollector();
425403
$sut->registerClient('http_client', $this->httpClientThatHasTracedRequests([
@@ -435,7 +413,7 @@ public function testItDoesNotGeneratesCurlCommandsForTooBigData()
435413
$collectedData = $sut->getClients();
436414
self::assertCount(1, $collectedData['http_client']['traces']);
437415
$curlCommand = $collectedData['http_client']['traces'][0]['curlCommand'];
438-
self::assertNull($curlCommand);
416+
self::assertNotNull($curlCommand);
439417
}
440418

441419
private function httpClientThatHasTracedRequests($tracedRequests): TraceableHttpClient

src/Symfony/Component/HttpKernel/Kernel.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,9 @@ private function preBoot(): ContainerInterface
752752
$this->startTime = microtime(true);
753753
}
754754
if ($this->debug && !isset($_ENV['SHELL_VERBOSITY']) && !isset($_SERVER['SHELL_VERBOSITY'])) {
755-
putenv('SHELL_VERBOSITY=3');
755+
if (\function_exists('putenv')) {
756+
putenv('SHELL_VERBOSITY=3');
757+
}
756758
$_ENV['SHELL_VERBOSITY'] = 3;
757759
$_SERVER['SHELL_VERBOSITY'] = 3;
758760
}

src/Symfony/Component/PasswordHasher/Tests/Hasher/NativePasswordHasherTest.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -51,25 +51,25 @@ public function testValidation()
5151
{
5252
$hasher = new NativePasswordHasher();
5353
$result = $hasher->hash('password', null);
54-
$this->assertTrue($hasher->verify($result, 'password', null));
55-
$this->assertFalse($hasher->verify($result, 'anotherPassword', null));
56-
$this->assertFalse($hasher->verify($result, '', null));
54+
$this->assertTrue($hasher->verify($result, 'password'));
55+
$this->assertFalse($hasher->verify($result, 'anotherPassword'));
56+
$this->assertFalse($hasher->verify($result, ''));
5757
}
5858

5959
public function testNonArgonValidation()
6060
{
6161
$hasher = new NativePasswordHasher();
62-
$this->assertTrue($hasher->verify('$5$abcdefgh$ZLdkj8mkc2XVSrPVjskDAgZPGjtj1VGVaa1aUkrMTU/', 'password', null));
63-
$this->assertFalse($hasher->verify('$5$abcdefgh$ZLdkj8mkc2XVSrPVjskDAgZPGjtj1VGVaa1aUkrMTU/', 'anotherPassword', null));
64-
$this->assertTrue($hasher->verify('$6$abcdefgh$yVfUwsw5T.JApa8POvClA1pQ5peiq97DUNyXCZN5IrF.BMSkiaLQ5kvpuEm/VQ1Tvh/KV2TcaWh8qinoW5dhA1', 'password', null));
65-
$this->assertFalse($hasher->verify('$6$abcdefgh$yVfUwsw5T.JApa8POvClA1pQ5peiq97DUNyXCZN5IrF.BMSkiaLQ5kvpuEm/VQ1Tvh/KV2TcaWh8qinoW5dhA1', 'anotherPassword', null));
62+
$this->assertTrue($hasher->verify('$5$abcdefgh$ZLdkj8mkc2XVSrPVjskDAgZPGjtj1VGVaa1aUkrMTU/', 'password'));
63+
$this->assertFalse($hasher->verify('$5$abcdefgh$ZLdkj8mkc2XVSrPVjskDAgZPGjtj1VGVaa1aUkrMTU/', 'anotherPassword'));
64+
$this->assertTrue($hasher->verify('$6$abcdefgh$yVfUwsw5T.JApa8POvClA1pQ5peiq97DUNyXCZN5IrF.BMSkiaLQ5kvpuEm/VQ1Tvh/KV2TcaWh8qinoW5dhA1', 'password'));
65+
$this->assertFalse($hasher->verify('$6$abcdefgh$yVfUwsw5T.JApa8POvClA1pQ5peiq97DUNyXCZN5IrF.BMSkiaLQ5kvpuEm/VQ1Tvh/KV2TcaWh8qinoW5dhA1', 'anotherPassword'));
6666
}
6767

6868
public function testConfiguredAlgorithm()
6969
{
7070
$hasher = new NativePasswordHasher(null, null, null, \PASSWORD_BCRYPT);
71-
$result = $hasher->hash('password', null);
72-
$this->assertTrue($hasher->verify($result, 'password', null));
71+
$result = $hasher->hash('password');
72+
$this->assertTrue($hasher->verify($result, 'password'));
7373
$this->assertStringStartsWith('$2', $result);
7474
}
7575

@@ -84,8 +84,8 @@ public function testDefaultAlgorithm()
8484
public function testConfiguredAlgorithmWithLegacyConstValue()
8585
{
8686
$hasher = new NativePasswordHasher(null, null, null, '1');
87-
$result = $hasher->hash('password', null);
88-
$this->assertTrue($hasher->verify($result, 'password', null));
87+
$result = $hasher->hash('password');
88+
$this->assertTrue($hasher->verify($result, 'password'));
8989
$this->assertStringStartsWith('$2', $result);
9090
}
9191

@@ -94,17 +94,17 @@ public function testBcryptWithLongPassword()
9494
$hasher = new NativePasswordHasher(null, null, 4, \PASSWORD_BCRYPT);
9595
$plainPassword = str_repeat('a', 100);
9696

97-
$this->assertFalse($hasher->verify(password_hash($plainPassword, \PASSWORD_BCRYPT, ['cost' => 4]), $plainPassword, 'salt'));
98-
$this->assertTrue($hasher->verify($hasher->hash($plainPassword), $plainPassword, 'salt'));
97+
$this->assertFalse($hasher->verify(password_hash($plainPassword, \PASSWORD_BCRYPT, ['cost' => 4]), $plainPassword));
98+
$this->assertTrue($hasher->verify($hasher->hash($plainPassword), $plainPassword));
9999
}
100100

101101
public function testBcryptWithNulByte()
102102
{
103103
$hasher = new NativePasswordHasher(null, null, 4, \PASSWORD_BCRYPT);
104104
$plainPassword = "a\0b";
105105

106-
$this->assertFalse($hasher->verify(password_hash($plainPassword, \PASSWORD_BCRYPT, ['cost' => 4]), $plainPassword, 'salt'));
107-
$this->assertTrue($hasher->verify($hasher->hash($plainPassword), $plainPassword, 'salt'));
106+
$this->assertFalse($hasher->verify(password_hash($plainPassword, \PASSWORD_BCRYPT, ['cost' => 4]), $plainPassword));
107+
$this->assertTrue($hasher->verify($hasher->hash($plainPassword), $plainPassword));
108108
}
109109

110110
public function testNeedsRehash()
@@ -113,7 +113,7 @@ public function testNeedsRehash()
113113

114114
$this->assertTrue($hasher->needsRehash('dummyhash'));
115115

116-
$hash = $hasher->hash('foo', 'salt');
116+
$hash = $hasher->hash('foo');
117117
$this->assertFalse($hasher->needsRehash($hash));
118118

119119
$hasher = new NativePasswordHasher(5, 11000, 5);

src/Symfony/Component/PasswordHasher/Tests/Hasher/PasswordHasherFactoryTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public function testGetNamedHasherForHasherAware()
109109
'hasher_name' => new MessageDigestPasswordHasher('sha1'),
110110
]);
111111

112-
$hasher = $factory->getPasswordHasher(new HasherAwareUser('user', 'pass'));
112+
$hasher = $factory->getPasswordHasher(new HasherAwareUser());
113113
$expectedHasher = new MessageDigestPasswordHasher('sha1');
114114
$this->assertEquals($expectedHasher->hash('foo', ''), $hasher->hash('foo', ''));
115115
}
@@ -121,7 +121,7 @@ public function testGetNullNamedHasherForHasherAware()
121121
'hasher_name' => new MessageDigestPasswordHasher('sha256'),
122122
]);
123123

124-
$user = new HasherAwareUser('mathilde', 'krogulec');
124+
$user = new HasherAwareUser();
125125
$user->hasherName = null;
126126
$hasher = $factory->getPasswordHasher($user);
127127
$expectedHasher = new MessageDigestPasswordHasher('sha1');
@@ -136,7 +136,7 @@ public function testGetInvalidNamedHasherForHasherAware()
136136
'hasher_name' => new MessageDigestPasswordHasher('sha256'),
137137
]);
138138

139-
$user = new HasherAwareUser('user', 'pass');
139+
$user = new HasherAwareUser();
140140
$user->hasherName = 'invalid_hasher_name';
141141
$factory->getPasswordHasher($user);
142142
}
@@ -167,9 +167,9 @@ public function testMigrateFrom()
167167
$hasher = $factory->getPasswordHasher(SomeUser::class);
168168
$this->assertInstanceOf(MigratingPasswordHasher::class, $hasher);
169169

170-
$this->assertTrue($hasher->verify((new SodiumPasswordHasher())->hash('foo', null), 'foo', null));
171-
$this->assertTrue($hasher->verify((new NativePasswordHasher(null, null, null, \PASSWORD_BCRYPT))->hash('foo', null), 'foo', null));
172-
$this->assertTrue($hasher->verify($digest->hash('foo', null), 'foo', null));
170+
$this->assertTrue($hasher->verify((new SodiumPasswordHasher())->hash('foo'), 'foo', null));
171+
$this->assertTrue($hasher->verify((new NativePasswordHasher(null, null, null, \PASSWORD_BCRYPT))->hash('foo'), 'foo', null));
172+
$this->assertTrue($hasher->verify($digest->hash('foo'), 'foo', null));
173173
$this->assertStringStartsWith(\SODIUM_CRYPTO_PWHASH_STRPREFIX, $hasher->hash('foo', null));
174174
}
175175

src/Symfony/Component/PasswordHasher/Tests/Hasher/SodiumPasswordHasherTest.php

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -28,65 +28,65 @@ protected function setUp(): void
2828
public function testValidation()
2929
{
3030
$hasher = new SodiumPasswordHasher();
31-
$result = $hasher->hash('password', null);
32-
$this->assertTrue($hasher->verify($result, 'password', null));
33-
$this->assertFalse($hasher->verify($result, 'anotherPassword', null));
34-
$this->assertFalse($hasher->verify($result, '', null));
31+
$result = $hasher->hash('password');
32+
$this->assertTrue($hasher->verify($result, 'password'));
33+
$this->assertFalse($hasher->verify($result, 'anotherPassword'));
34+
$this->assertFalse($hasher->verify($result, ''));
3535
}
3636

3737
public function testBcryptValidation()
3838
{
3939
$hasher = new SodiumPasswordHasher();
40-
$this->assertTrue($hasher->verify('$2y$04$M8GDODMoGQLQRpkYCdoJh.lbiZPee3SZI32RcYK49XYTolDGwoRMm', 'abc', null));
40+
$this->assertTrue($hasher->verify('$2y$04$M8GDODMoGQLQRpkYCdoJh.lbiZPee3SZI32RcYK49XYTolDGwoRMm', 'abc'));
4141
}
4242

4343
public function testNonArgonValidation()
4444
{
4545
$hasher = new SodiumPasswordHasher();
46-
$this->assertTrue($hasher->verify('$5$abcdefgh$ZLdkj8mkc2XVSrPVjskDAgZPGjtj1VGVaa1aUkrMTU/', 'password', null));
47-
$this->assertFalse($hasher->verify('$5$abcdefgh$ZLdkj8mkc2XVSrPVjskDAgZPGjtj1VGVaa1aUkrMTU/', 'anotherPassword', null));
48-
$this->assertTrue($hasher->verify('$6$abcdefgh$yVfUwsw5T.JApa8POvClA1pQ5peiq97DUNyXCZN5IrF.BMSkiaLQ5kvpuEm/VQ1Tvh/KV2TcaWh8qinoW5dhA1', 'password', null));
49-
$this->assertFalse($hasher->verify('$6$abcdefgh$yVfUwsw5T.JApa8POvClA1pQ5peiq97DUNyXCZN5IrF.BMSkiaLQ5kvpuEm/VQ1Tvh/KV2TcaWh8qinoW5dhA1', 'anotherPassword', null));
46+
$this->assertTrue($hasher->verify('$5$abcdefgh$ZLdkj8mkc2XVSrPVjskDAgZPGjtj1VGVaa1aUkrMTU/', 'password'));
47+
$this->assertFalse($hasher->verify('$5$abcdefgh$ZLdkj8mkc2XVSrPVjskDAgZPGjtj1VGVaa1aUkrMTU/', 'anotherPassword'));
48+
$this->assertTrue($hasher->verify('$6$abcdefgh$yVfUwsw5T.JApa8POvClA1pQ5peiq97DUNyXCZN5IrF.BMSkiaLQ5kvpuEm/VQ1Tvh/KV2TcaWh8qinoW5dhA1', 'password'));
49+
$this->assertFalse($hasher->verify('$6$abcdefgh$yVfUwsw5T.JApa8POvClA1pQ5peiq97DUNyXCZN5IrF.BMSkiaLQ5kvpuEm/VQ1Tvh/KV2TcaWh8qinoW5dhA1', 'anotherPassword'));
5050
}
5151

5252
public function testHashLength()
5353
{
5454
$this->expectException(InvalidPasswordException::class);
5555
$hasher = new SodiumPasswordHasher();
56-
$hasher->hash(str_repeat('a', 4097), 'salt');
56+
$hasher->hash(str_repeat('a', 4097));
5757
}
5858

5959
public function testCheckPasswordLength()
6060
{
6161
$hasher = new SodiumPasswordHasher();
62-
$result = $hasher->hash(str_repeat('a', 4096), null);
63-
$this->assertFalse($hasher->verify($result, str_repeat('a', 4097), null));
64-
$this->assertTrue($hasher->verify($result, str_repeat('a', 4096), null));
62+
$result = $hasher->hash(str_repeat('a', 4096));
63+
$this->assertFalse($hasher->verify($result, str_repeat('a', 4097)));
64+
$this->assertTrue($hasher->verify($result, str_repeat('a', 4096)));
6565
}
6666

6767
public function testBcryptWithLongPassword()
6868
{
69-
$hasher = new SodiumPasswordHasher(null, null, 4);
69+
$hasher = new SodiumPasswordHasher(null, null);
7070
$plainPassword = str_repeat('a', 100);
7171

72-
$this->assertFalse($hasher->verify(password_hash($plainPassword, \PASSWORD_BCRYPT, ['cost' => 4]), $plainPassword, 'salt'));
73-
$this->assertTrue($hasher->verify((new NativePasswordHasher(null, null, 4, \PASSWORD_BCRYPT))->hash($plainPassword), $plainPassword, 'salt'));
72+
$this->assertFalse($hasher->verify(password_hash($plainPassword, \PASSWORD_BCRYPT, ['cost' => 4]), $plainPassword));
73+
$this->assertTrue($hasher->verify((new NativePasswordHasher(null, null, 4, \PASSWORD_BCRYPT))->hash($plainPassword), $plainPassword));
7474
}
7575

7676
public function testBcryptWithNulByte()
7777
{
78-
$hasher = new SodiumPasswordHasher(null, null, 4);
78+
$hasher = new SodiumPasswordHasher(null, null);
7979
$plainPassword = "a\0b";
8080

81-
$this->assertFalse($hasher->verify(password_hash($plainPassword, \PASSWORD_BCRYPT, ['cost' => 4]), $plainPassword, 'salt'));
82-
$this->assertTrue($hasher->verify((new NativePasswordHasher(null, null, 4, \PASSWORD_BCRYPT))->hash($plainPassword), $plainPassword, 'salt'));
81+
$this->assertFalse($hasher->verify(password_hash($plainPassword, \PASSWORD_BCRYPT, ['cost' => 4]), $plainPassword));
82+
$this->assertTrue($hasher->verify((new NativePasswordHasher(null, null, 4, \PASSWORD_BCRYPT))->hash($plainPassword), $plainPassword));
8383
}
8484

8585
public function testUserProvidedSaltIsNotUsed()
8686
{
8787
$hasher = new SodiumPasswordHasher();
88-
$result = $hasher->hash('password', 'salt');
89-
$this->assertTrue($hasher->verify($result, 'password', 'anotherSalt'));
88+
$result = $hasher->hash('password');
89+
$this->assertTrue($hasher->verify($result, 'password'));
9090
}
9191

9292
public function testNeedsRehash()
@@ -95,7 +95,7 @@ public function testNeedsRehash()
9595

9696
$this->assertTrue($hasher->needsRehash('dummyhash'));
9797

98-
$hash = $hasher->hash('foo', 'salt');
98+
$hash = $hasher->hash('foo');
9999
$this->assertFalse($hasher->needsRehash($hash));
100100

101101
$hasher = new SodiumPasswordHasher(5, 11000);

src/Symfony/Component/Yaml/Inline.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ private static function parseMapping(string $mapping, int $flags, int &$i = 0, a
527527
if ('<<' === $key) {
528528
$output += $value;
529529
} elseif ($allowOverwrite || !isset($output[$key])) {
530-
if (!$isValueQuoted && \is_string($value) && '' !== $value && '&' === $value[0] && Parser::preg_match(Parser::REFERENCE_PATTERN, $value, $matches)) {
530+
if (!$isValueQuoted && \is_string($value) && '' !== $value && '&' === $value[0] && !self::isBinaryString($value) && Parser::preg_match(Parser::REFERENCE_PATTERN, $value, $matches)) {
531531
$references[$matches['ref']] = $matches['value'];
532532
$value = $matches['value'];
533533
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy