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
This commit is contained in:
commit
f1230757c3
@ -37,7 +37,6 @@ class SymfonyTestsListenerTrait
|
|||||||
private $expectedDeprecations = array();
|
private $expectedDeprecations = array();
|
||||||
private $gatheredDeprecations = array();
|
private $gatheredDeprecations = array();
|
||||||
private $previousErrorHandler;
|
private $previousErrorHandler;
|
||||||
private $reportUselessTests;
|
|
||||||
private $error;
|
private $error;
|
||||||
private $runsInSeparateProcess = false;
|
private $runsInSeparateProcess = false;
|
||||||
|
|
||||||
@ -196,10 +195,6 @@ class SymfonyTestsListenerTrait
|
|||||||
public function startTest($test)
|
public function startTest($test)
|
||||||
{
|
{
|
||||||
if (-2 < $this->state && ($test instanceof \PHPUnit\Framework\TestCase || $test instanceof TestCase)) {
|
if (-2 < $this->state && ($test instanceof \PHPUnit\Framework\TestCase || $test instanceof TestCase)) {
|
||||||
if (null !== $test->getTestResultObject()) {
|
|
||||||
$this->reportUselessTests = $test->getTestResultObject()->isStrictAboutTestsThatDoNotTestAnything();
|
|
||||||
}
|
|
||||||
|
|
||||||
// This event is triggered before the test is re-run in isolation
|
// This event is triggered before the test is re-run in isolation
|
||||||
if ($this->willBeIsolated($test)) {
|
if ($this->willBeIsolated($test)) {
|
||||||
$this->runsInSeparateProcess = tempnam(sys_get_temp_dir(), 'deprec');
|
$this->runsInSeparateProcess = tempnam(sys_get_temp_dir(), 'deprec');
|
||||||
@ -255,11 +250,6 @@ class SymfonyTestsListenerTrait
|
|||||||
$className = \get_class($test);
|
$className = \get_class($test);
|
||||||
$groups = $Test::getGroups($className, $test->getName(false));
|
$groups = $Test::getGroups($className, $test->getName(false));
|
||||||
|
|
||||||
if (null !== $this->reportUselessTests) {
|
|
||||||
$test->getTestResultObject()->beStrictAboutTestsThatDoNotTestAnything($this->reportUselessTests);
|
|
||||||
$this->reportUselessTests = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($errored = null !== $this->error) {
|
if ($errored = null !== $this->error) {
|
||||||
$test->getTestResultObject()->addError($test, $this->error, 0);
|
$test->getTestResultObject()->addError($test, $this->error, 0);
|
||||||
$this->error = null;
|
$this->error = null;
|
||||||
|
@ -212,7 +212,7 @@ class Filesystem
|
|||||||
* Change the owner of an array of files or directories.
|
* Change the owner of an array of files or directories.
|
||||||
*
|
*
|
||||||
* @param string|iterable $files A filename, an array of files, or a \Traversable instance to change owner
|
* @param string|iterable $files A filename, an array of files, or a \Traversable instance to change owner
|
||||||
* @param string $user The new owner user name
|
* @param string|int $user A user name or number
|
||||||
* @param bool $recursive Whether change the owner recursively or not
|
* @param bool $recursive Whether change the owner recursively or not
|
||||||
*
|
*
|
||||||
* @throws IOException When the change fails
|
* @throws IOException When the change fails
|
||||||
@ -239,7 +239,7 @@ class Filesystem
|
|||||||
* Change the group of an array of files or directories.
|
* Change the group of an array of files or directories.
|
||||||
*
|
*
|
||||||
* @param string|iterable $files A filename, an array of files, or a \Traversable instance to change group
|
* @param string|iterable $files A filename, an array of files, or a \Traversable instance to change group
|
||||||
* @param string $group The group name
|
* @param string|int $group A group name or number
|
||||||
* @param bool $recursive Whether change the group recursively or not
|
* @param bool $recursive Whether change the group recursively or not
|
||||||
*
|
*
|
||||||
* @throws IOException When the change fails
|
* @throws IOException When the change fails
|
||||||
|
@ -353,6 +353,10 @@ class HttpCache implements HttpKernelInterface, TerminableInterface
|
|||||||
return $this->validate($request, $entry, $catch);
|
return $this->validate($request, $entry, $catch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($entry->headers->hasCacheControlDirective('no-cache')) {
|
||||||
|
return $this->validate($request, $entry, $catch);
|
||||||
|
}
|
||||||
|
|
||||||
$this->record($request, 'fresh');
|
$this->record($request, 'fresh');
|
||||||
|
|
||||||
$entry->headers->set('Age', $entry->getAge());
|
$entry->headers->set('Age', $entry->getAge());
|
||||||
|
@ -443,6 +443,22 @@ class HttpCacheTest extends HttpCacheTestCase
|
|||||||
$this->assertTrue($this->response->headers->has('Age'));
|
$this->assertTrue($this->response->headers->has('Age'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testRevalidatesResponsesWithNoCacheDirectiveEvenIfFresh()
|
||||||
|
{
|
||||||
|
$this->setNextResponse(200, ['Cache-Control' => 'public, no-cache, max-age=10', 'ETag' => 'some-etag'], 'OK');
|
||||||
|
$this->request('GET', '/'); // warm the cache
|
||||||
|
|
||||||
|
sleep(5);
|
||||||
|
|
||||||
|
$this->setNextResponse(304, ['Cache-Control' => 'public, no-cache, max-age=10', 'ETag' => 'some-etag']);
|
||||||
|
$this->request('GET', '/');
|
||||||
|
|
||||||
|
$this->assertHttpKernelIsCalled(); // no-cache -> MUST have revalidated at origin
|
||||||
|
$this->assertTraceContains('valid');
|
||||||
|
$this->assertEquals('OK', $this->response->getContent());
|
||||||
|
$this->assertEquals(0, $this->response->getAge());
|
||||||
|
}
|
||||||
|
|
||||||
public function testCachesResponsesWithAnExpirationHeader()
|
public function testCachesResponsesWithAnExpirationHeader()
|
||||||
{
|
{
|
||||||
$time = \DateTime::createFromFormat('U', time() + 5);
|
$time = \DateTime::createFromFormat('U', time() + 5);
|
||||||
|
@ -94,7 +94,7 @@ class TokenBasedRememberMeServices extends AbstractRememberMeServices
|
|||||||
* @param string $class
|
* @param string $class
|
||||||
* @param string $username The username
|
* @param string $username The username
|
||||||
* @param int $expires The Unix timestamp when the cookie expires
|
* @param int $expires The Unix timestamp when the cookie expires
|
||||||
* @param string $password The encoded password
|
* @param string|null $password The encoded password
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
@ -116,7 +116,7 @@ class TokenBasedRememberMeServices extends AbstractRememberMeServices
|
|||||||
* @param string $class
|
* @param string $class
|
||||||
* @param string $username The username
|
* @param string $username The username
|
||||||
* @param int $expires The Unix timestamp when the cookie expires
|
* @param int $expires The Unix timestamp when the cookie expires
|
||||||
* @param string $password The encoded password
|
* @param string|null $password The encoded password
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
@ -24,11 +24,11 @@
|
|||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="6">
|
<trans-unit id="6">
|
||||||
<source>You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices.</source>
|
<source>You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices.</source>
|
||||||
<target>Morate odabrati bar {{ limit }} mogućnost.|Morate odabrati bar {{ limit }} mogućnosti.</target>
|
<target>Morate odabrati bar {{ limit }} mogućnost.|Morate odabrati bar {{ limit }} mogućnosti.|Morate odabrati bar {{ limit }} mogućnosti.</target>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="7">
|
<trans-unit id="7">
|
||||||
<source>You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices.</source>
|
<source>You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices.</source>
|
||||||
<target>Morate odabrati najviše {{ limit }} mogućnost.|Morate odabrati najviše {{ limit }} mogućnosti.</target>
|
<target>Morate odabrati najviše {{ limit }} mogućnost.|Morate odabrati najviše {{ limit }} mogućnosti.|Morate odabrati najviše {{ limit }} mogućnosti.</target>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="8">
|
<trans-unit id="8">
|
||||||
<source>One or more of the given values is invalid.</source>
|
<source>One or more of the given values is invalid.</source>
|
||||||
@ -76,7 +76,7 @@
|
|||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="19">
|
<trans-unit id="19">
|
||||||
<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>
|
<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>
|
||||||
<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>
|
<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>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="20">
|
<trans-unit id="20">
|
||||||
<source>This value should be {{ limit }} or more.</source>
|
<source>This value should be {{ limit }} or more.</source>
|
||||||
@ -84,7 +84,7 @@
|
|||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="21">
|
<trans-unit id="21">
|
||||||
<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>
|
<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>
|
||||||
<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>
|
<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>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="22">
|
<trans-unit id="22">
|
||||||
<source>This value should not be blank.</source>
|
<source>This value should not be blank.</source>
|
||||||
@ -180,7 +180,7 @@
|
|||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="48">
|
<trans-unit id="48">
|
||||||
<source>This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters.</source>
|
<source>This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters.</source>
|
||||||
<target>Vrednost bi trebalo da ima tačno {{ limit }} karakter.|Vrednost bi trebalo da ima tačno {{ limit }} karaktera.</target>
|
<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>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="49">
|
<trans-unit id="49">
|
||||||
<source>The file was only partially uploaded.</source>
|
<source>The file was only partially uploaded.</source>
|
||||||
@ -204,15 +204,15 @@
|
|||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="54">
|
<trans-unit id="54">
|
||||||
<source>This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more.</source>
|
<source>This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more.</source>
|
||||||
<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>
|
<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>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="55">
|
<trans-unit id="55">
|
||||||
<source>This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less.</source>
|
<source>This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less.</source>
|
||||||
<target>Ova kolekcija bi trebalo da sadrži {{ limit }} ili manje elemenata.|Ova kolekcija bi trebalo da sadrži {{ limit }} ili manje elemenata.</target>
|
<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>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="56">
|
<trans-unit id="56">
|
||||||
<source>This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements.</source>
|
<source>This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements.</source>
|
||||||
<target>Ova kolekcija bi trebalo da sadrži tačno {{ limit }} element.|Ova kolekcija bi trebalo da sadrži tačno {{ limit }} elemenata.</target>
|
<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>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="57">
|
<trans-unit id="57">
|
||||||
<source>Invalid card number.</source>
|
<source>Invalid card number.</source>
|
||||||
|
@ -434,6 +434,11 @@ class Inline
|
|||||||
throw new ParseException('Missing mapping key.', self::$parsedLineNumber + 1, $mapping);
|
throw new ParseException('Missing mapping key.', self::$parsedLineNumber + 1, $mapping);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ('!php/const' === $key) {
|
||||||
|
$key .= ' '.self::parseScalar($mapping, $flags, [':'], $i, false, []);
|
||||||
|
$key = self::evaluateScalar($key, $flags);
|
||||||
|
}
|
||||||
|
|
||||||
if (false === $i = strpos($mapping, ':', $i)) {
|
if (false === $i = strpos($mapping, ':', $i)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -59,6 +59,7 @@ class InlineTest extends TestCase
|
|||||||
['!php/const PHP_INT_MAX', PHP_INT_MAX],
|
['!php/const PHP_INT_MAX', PHP_INT_MAX],
|
||||||
['[!php/const PHP_INT_MAX]', [PHP_INT_MAX]],
|
['[!php/const PHP_INT_MAX]', [PHP_INT_MAX]],
|
||||||
['{ foo: !php/const PHP_INT_MAX }', ['foo' => PHP_INT_MAX]],
|
['{ foo: !php/const PHP_INT_MAX }', ['foo' => PHP_INT_MAX]],
|
||||||
|
['{ !php/const PHP_INT_MAX: foo }', [PHP_INT_MAX => 'foo']],
|
||||||
['!php/const NULL', null],
|
['!php/const NULL', null],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user