Skip to content

Commit f123075

Browse files
committed
Merge branch '3.4' into 4.3
* 3.4: chown and chgrp should also accept int as owner and group Fix RememberMe with null password [Validator] Fix plurals for sr_Latn (Serbian language written in latin script) validation messages [PhpUnitBridge][SymfonyTestsListenerTrait] Remove some unneeded code fix PHP const mapping keys using the inline notation Fix that no-cache requires positive validation with the origin, even for fresh responses
2 parents 477e843 + ff174df commit f123075

File tree

8 files changed

+44
-28
lines changed

8 files changed

+44
-28
lines changed

src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ class SymfonyTestsListenerTrait
3737
private $expectedDeprecations = array();
3838
private $gatheredDeprecations = array();
3939
private $previousErrorHandler;
40-
private $reportUselessTests;
4140
private $error;
4241
private $runsInSeparateProcess = false;
4342

@@ -196,10 +195,6 @@ public function addSkippedTest($test, \Exception $e, $time)
196195
public function startTest($test)
197196
{
198197
if (-2 < $this->state && ($test instanceof \PHPUnit\Framework\TestCase || $test instanceof TestCase)) {
199-
if (null !== $test->getTestResultObject()) {
200-
$this->reportUselessTests = $test->getTestResultObject()->isStrictAboutTestsThatDoNotTestAnything();
201-
}
202-
203198
// This event is triggered before the test is re-run in isolation
204199
if ($this->willBeIsolated($test)) {
205200
$this->runsInSeparateProcess = tempnam(sys_get_temp_dir(), 'deprec');
@@ -255,11 +250,6 @@ public function endTest($test, $time)
255250
$className = \get_class($test);
256251
$groups = $Test::getGroups($className, $test->getName(false));
257252

258-
if (null !== $this->reportUselessTests) {
259-
$test->getTestResultObject()->beStrictAboutTestsThatDoNotTestAnything($this->reportUselessTests);
260-
$this->reportUselessTests = null;
261-
}
262-
263253
if ($errored = null !== $this->error) {
264254
$test->getTestResultObject()->addError($test, $this->error, 0);
265255
$this->error = null;

src/Symfony/Component/Filesystem/Filesystem.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ public function chmod($files, $mode, $umask = 0000, $recursive = false)
212212
* Change the owner of an array of files or directories.
213213
*
214214
* @param string|iterable $files A filename, an array of files, or a \Traversable instance to change owner
215-
* @param string $user The new owner user name
215+
* @param string|int $user A user name or number
216216
* @param bool $recursive Whether change the owner recursively or not
217217
*
218218
* @throws IOException When the change fails
@@ -239,7 +239,7 @@ public function chown($files, $user, $recursive = false)
239239
* Change the group of an array of files or directories.
240240
*
241241
* @param string|iterable $files A filename, an array of files, or a \Traversable instance to change group
242-
* @param string $group The group name
242+
* @param string|int $group A group name or number
243243
* @param bool $recursive Whether change the group recursively or not
244244
*
245245
* @throws IOException When the change fails

src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,10 @@ protected function lookup(Request $request, $catch = false)
353353
return $this->validate($request, $entry, $catch);
354354
}
355355

356+
if ($entry->headers->hasCacheControlDirective('no-cache')) {
357+
return $this->validate($request, $entry, $catch);
358+
}
359+
356360
$this->record($request, 'fresh');
357361

358362
$entry->headers->set('Age', $entry->getAge());

src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,22 @@ public function testCachesResponsesWithExplicitNoCacheDirective()
443443
$this->assertTrue($this->response->headers->has('Age'));
444444
}
445445

446+
public function testRevalidatesResponsesWithNoCacheDirectiveEvenIfFresh()
447+
{
448+
$this->setNextResponse(200, ['Cache-Control' => 'public, no-cache, max-age=10', 'ETag' => 'some-etag'], 'OK');
449+
$this->request('GET', '/'); // warm the cache
450+
451+
sleep(5);
452+
453+
$this->setNextResponse(304, ['Cache-Control' => 'public, no-cache, max-age=10', 'ETag' => 'some-etag']);
454+
$this->request('GET', '/');
455+
456+
$this->assertHttpKernelIsCalled(); // no-cache -> MUST have revalidated at origin
457+
$this->assertTraceContains('valid');
458+
$this->assertEquals('OK', $this->response->getContent());
459+
$this->assertEquals(0, $this->response->getAge());
460+
}
461+
446462
public function testCachesResponsesWithAnExpirationHeader()
447463
{
448464
$time = \DateTime::createFromFormat('U', time() + 5);

src/Symfony/Component/Security/Http/RememberMe/TokenBasedRememberMeServices.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,10 @@ protected function onLoginSuccess(Request $request, Response $response, TokenInt
9191
/**
9292
* Generates the cookie value.
9393
*
94-
* @param string $class
95-
* @param string $username The username
96-
* @param int $expires The Unix timestamp when the cookie expires
97-
* @param string $password The encoded password
94+
* @param string $class
95+
* @param string $username The username
96+
* @param int $expires The Unix timestamp when the cookie expires
97+
* @param string|null $password The encoded password
9898
*
9999
* @return string
100100
*/
@@ -113,10 +113,10 @@ protected function generateCookieValue($class, $username, $expires, $password)
113113
/**
114114
* Generates a hash for the cookie to ensure it is not being tampered with.
115115
*
116-
* @param string $class
117-
* @param string $username The username
118-
* @param int $expires The Unix timestamp when the cookie expires
119-
* @param string $password The encoded password
116+
* @param string $class
117+
* @param string $username The username
118+
* @param int $expires The Unix timestamp when the cookie expires
119+
* @param string|null $password The encoded password
120120
*
121121
* @return string
122122
*/

src/Symfony/Component/Validator/Resources/translations/validators.sr_Latn.xlf

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@
2424
</trans-unit>
2525
<trans-unit id="6">
2626
<source>You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices.</source>
27-
<target>Morate odabrati bar {{ limit }} mogućnost.|Morate odabrati bar {{ limit }} mogućnosti.</target>
27+
<target>Morate odabrati bar {{ limit }} mogućnost.|Morate odabrati bar {{ limit }} mogućnosti.|Morate odabrati bar {{ limit }} mogućnosti.</target>
2828
</trans-unit>
2929
<trans-unit id="7">
3030
<source>You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices.</source>
31-
<target>Morate odabrati najviše {{ limit }} mogućnost.|Morate odabrati najviše {{ limit }} mogućnosti.</target>
31+
<target>Morate odabrati najviše {{ limit }} mogućnost.|Morate odabrati najviše {{ limit }} mogućnosti.|Morate odabrati najviše {{ limit }} mogućnosti.</target>
3232
</trans-unit>
3333
<trans-unit id="8">
3434
<source>One or more of the given values is invalid.</source>
@@ -76,15 +76,15 @@
7676
</trans-unit>
7777
<trans-unit id="19">
7878
<source>This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less.</source>
79-
<target>Vrednost je predugačka. Trebalo bi da ima {{ limit }} karakter ili manje.|Vrednost je predugačka. Trebalo bi da ima {{ limit }} karaktera ili manje.</target>
79+
<target>Vrednost je predugačka. Trebalo bi da ima {{ limit }} karakter ili manje.|Vrednost je predugačka. Trebalo bi da ima {{ limit }} karaktera ili manje.|Vrednost je predugačka. Trebalo bi da ima {{ limit }} karaktera ili manje.</target>
8080
</trans-unit>
8181
<trans-unit id="20">
8282
<source>This value should be {{ limit }} or more.</source>
8383
<target>Vrednost bi trebalo da bude {{ limit }} ili više.</target>
8484
</trans-unit>
8585
<trans-unit id="21">
8686
<source>This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more.</source>
87-
<target>Vrednost je prekratka. Trebalo bi da ima {{ limit }} karakter ili više.|Vrednost je prekratka. Trebalo bi da ima {{ limit }} karaktera ili više.</target>
87+
<target>Vrednost je prekratka. Trebalo bi da ima {{ limit }} karakter ili više.|Vrednost je prekratka. Trebalo bi da ima {{ limit }} karaktera ili više.|Vrednost je prekratka. Trebalo bi da ima {{ limit }} karaktera ili više.</target>
8888
</trans-unit>
8989
<trans-unit id="22">
9090
<source>This value should not be blank.</source>
@@ -180,7 +180,7 @@
180180
</trans-unit>
181181
<trans-unit id="48">
182182
<source>This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters.</source>
183-
<target>Vrednost bi trebalo da ima tačno {{ limit }} karakter.|Vrednost bi trebalo da ima tačno {{ limit }} karaktera.</target>
183+
<target>Vrednost bi trebalo da ima tačno {{ limit }} karakter.|Vrednost bi trebalo da ima tačno {{ limit }} karaktera.|Vrednost bi trebalo da ima tačno {{ limit }} karaktera.</target>
184184
</trans-unit>
185185
<trans-unit id="49">
186186
<source>The file was only partially uploaded.</source>
@@ -204,15 +204,15 @@
204204
</trans-unit>
205205
<trans-unit id="54">
206206
<source>This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more.</source>
207-
<target>Ova kolekcija bi trebalo da sadrži {{ limit }} ili više elemenata.|Ova kolekcija bi trebalo da sadrži {{ limit }} ili više elemenata.</target>
207+
<target>Ova kolekcija bi trebalo da sadrži {{ limit }} ili više elemenata.|Ova kolekcija bi trebalo da sadrži {{ limit }} ili više elemenata.|Ova kolekcija bi trebalo da sadrži {{ limit }} ili više elemenata.</target>
208208
</trans-unit>
209209
<trans-unit id="55">
210210
<source>This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less.</source>
211-
<target>Ova kolekcija bi trebalo da sadrži {{ limit }} ili manje elemenata.|Ova kolekcija bi trebalo da sadrži {{ limit }} ili manje elemenata.</target>
211+
<target>Ova kolekcija bi trebalo da sadrži {{ limit }} ili manje elemenata.|Ova kolekcija bi trebalo da sadrži {{ limit }} ili manje elemenata.|Ova kolekcija bi trebalo da sadrži {{ limit }} ili manje elemenata.</target>
212212
</trans-unit>
213213
<trans-unit id="56">
214214
<source>This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements.</source>
215-
<target>Ova kolekcija bi trebalo da sadrži tačno {{ limit }} element.|Ova kolekcija bi trebalo da sadrži tačno {{ limit }} elemenata.</target>
215+
<target>Ova kolekcija bi trebalo da sadrži tačno {{ limit }} element.|Ova kolekcija bi trebalo da sadrži tačno {{ limit }} elementa.|Ova kolekcija bi trebalo da sadrži tačno {{ limit }} elemenata.</target>
216216
</trans-unit>
217217
<trans-unit id="57">
218218
<source>Invalid card number.</source>

src/Symfony/Component/Yaml/Inline.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,11 @@ private static function parseMapping(string $mapping, int $flags, int &$i = 0, a
434434
throw new ParseException('Missing mapping key.', self::$parsedLineNumber + 1, $mapping);
435435
}
436436

437+
if ('!php/const' === $key) {
438+
$key .= ' '.self::parseScalar($mapping, $flags, [':'], $i, false, []);
439+
$key = self::evaluateScalar($key, $flags);
440+
}
441+
437442
if (false === $i = strpos($mapping, ':', $i)) {
438443
break;
439444
}

src/Symfony/Component/Yaml/Tests/InlineTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ public function getTestsForParsePhpConstants()
5959
['!php/const PHP_INT_MAX', PHP_INT_MAX],
6060
['[!php/const PHP_INT_MAX]', [PHP_INT_MAX]],
6161
['{ foo: !php/const PHP_INT_MAX }', ['foo' => PHP_INT_MAX]],
62+
['{ !php/const PHP_INT_MAX: foo }', [PHP_INT_MAX => 'foo']],
6263
['!php/const NULL', null],
6364
];
6465
}

0 commit comments

Comments
 (0)