8000 Merge branch '4.3' into 4.4 · symfony/symfony@50167b9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 50167b9

Browse files
Merge branch '4.3' into 4.4
* 4.3: cleanups Disable PHPUnit result cache on the CI [Security] Cleanup "Digest nonce has expired." translation [Translation] Highlight invalid translation status Added translations in validator for Serbian Cyrillic Added translations in validator for Serbian Latin [EventDispatcher] wrong Request class [DependencyInjection] improved exception message
2 parents 24858f2 + 9d9f558 commit 50167b9

File tree

17 files changed

+140
-16
lines changed

17 files changed

+140
-16
lines changed

.appveyor.yml

Lines changed: 1 addition & 0 deletions
6D40
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ init:
1212
- SET SYMFONY_DEPRECATIONS_HELPER=strict
1313
- SET "SYMFONY_REQUIRE=>=4.2"
1414
- SET ANSICON=121x90 (121x90)
15+
- SET SYMFONY_PHPUNIT_DISABLE_RESULT_CACHE=1
1516
- REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Command Processor" /v DelayedExpansion /t REG_DWORD /d 1 /f
1617

1718
install:

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ env:
2121
- SYMFONY_PROCESS_PHP_TEST_BINARY=~/.phpenv/shims/php
2222
- MESSENGER_AMQP_DSN=amqp://localhost/%2f/messages
2323
- MESSENGER_REDIS_DSN=redis://127.0.0.1:7001/messages
24+
- SYMFONY_PHPUNIT_DISABLE_RESULT_CACHE=1
2425

2526
matrix:
2627
include:

src/Symfony/Bridge/PhpUnit/bin/simple-phpunit.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,14 @@ class SymfonyBlacklistPhpunit {}
185185
global $argv, $argc;
186186
$argv = isset($_SERVER['argv']) ? $_SERVER['argv'] : array();
187187
$argc = isset($_SERVER['argc']) ? $_SERVER['argc'] : 0;
188+
189+
if ($PHPUNIT_VERSION < 8.0) {
190+
$argv = array_filter($argv, function ($v) use (&$argc) { if ('--do-not-cache-result' !== $v) return true; --$argc; });
191+
} elseif (filter_var(getenv('SYMFONY_PHPUNIT_DISABLE_RESULT_CACHE'), FILTER_VALIDATE_BOOLEAN)) {
192+
$argv[] = '--do-not-cache-result';
193+
++$argc;
194+
}
195+
188196
$components = array();
189197
$cmd = array_map('escapeshellarg', $argv);
190198
$exit = 0;

src/Symfony/Component/Config/Definition/BaseNode.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,9 +366,9 @@ final public function normalize($value)
366366
/**
367367
* Normalizes the value before any other normalization is applied.
368368
*
369-
* @param $value
369+
* @param mixed $value
370370
*
371-
* @return The normalized array value
371+
* @return mixed The normalized array value
372372
*/
373373
protected function preNormalize($value)
374374
{

src/Symfony/Component/DependencyInjection/Compiler/ResolveClassPass.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,13 @@ public function process(ContainerBuilder $container)
2929
if ($definition->isSynthetic() || null !== $definition->getClass()) {
3030
continue;
3131
}
32-
if (preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+(?:\\\\[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+)++$/', $id)) {
32+
if (preg_match('/^\\\\?[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+(?:\\\\[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+)++$/', $id)) {
3333
if ($definition instanceof ChildDefinition && !class_exists($id)) {
3434
throw new InvalidArgumentException(sprintf('Service definition "%s" has a parent but no class, and its name looks like a FQCN. Either the class is missing or you want to inherit it from the parent service. To resolve this ambiguity, please rename this service to a non-FQCN (e.g. using dots), or create the missing class.', $id));
3535
}
36+
if ('\\' === $id[0]) {
37+
throw new InvalidArgumentException(sprintf('Service definition "%s" has no class, and its name looks like a FQCN but it starts with a backslash; remove the leading backslash.', $id));
38+
}
3639
$definition->setClass($id);
3740
}
3841
}

src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveClassPassTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Symfony\Component\DependencyInjection\ChildDefinition;
1616
use Symfony\Component\DependencyInjection\Compiler\ResolveClassPass;
1717
use Symfony\Component\DependencyInjection\ContainerBuilder;
18+
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
1819
use Symfony\Component\DependencyInjection\Tests\Fixtures\CaseSensitiveClass;
1920

2021
class ResolveClassPassTest extends TestCase
@@ -58,6 +59,17 @@ public function provideInvalidClassId()
5859
yield ['\DateTime'];
5960
}
6061

62+
public function testWontResolveClassFromClassIdWithLeadingBackslash()
63+
{
64+
$this->expectException(InvalidArgumentException::class);
65+
$this->expectExceptionMessage('Service definition "\App\Some\Service" has no class, and its name looks like a FQCN but it starts with a backslash; remove the leading backslash.');
66+
67+
$container = new ContainerBuilder();
68+
$container->register('\App\Some\Service');
69+
70+
(new ResolveClassPass())->process($container);
71+
}
72+
6173
public function testNonFqcnChildDefinition()
6274
{
6375
$container = new ContainerBuilder();

src/Symfony/Component/DependencyInjection/Tests/Compiler/ValidateEnvPlaceholdersPassTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,6 @@ public function testEmptyConfigFromMoreThanOneSource()
282282
$container = new ContainerBuilder();
283283
$container->registerExtension(new Env F987 Extension(new ConfigurationWithArrayNodeRequiringOneElement()));
284284
$container->loadFromExtension('env_extension', []);
285-
$container->loadFromExtension('env_extension', []);
286285

287286
$this->doProcess($container);
288287

src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313

1414
use Psr\EventDispatcher\StoppableEventInterface;
1515
use Psr\Log\LoggerInterface;
16-
use Symfony\Component\BrowserKit\Request;
1716
use Symfony\Component\EventDispatcher\Event;
1817
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
1918
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
2019
use Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy;
2120
use Symfony\Component\EventDispatcher\LegacyEventProxy;
21+
use Symfony\Component\HttpFoundation\Request;
2222
use Symfony\Component\HttpFoundation\RequestStack;
2323
use Symfony\Component\Stopwatch\Stopwatch;
2424
use Symfony\Contracts\EventDispatcher\Event as ContractsEvent;

src/Symfony/Component/Form/Tests/FormRegistryTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ public function testHasTypeIfFQCN()
210210
$this->resolvedTypeFactory
211211
->expects($this->any())
212212
->method('createResolvedType')
213-
->will($this->returnValue($this->createMock(ResolvedFormTypeInterface::class)));
213+
->willReturn($this->createMock(ResolvedFormTypeInterface::class));
214214

215215
$this->assertTrue($this->registry->hasType('Symfony\Component\Form\Tests\Fixtures\FooType'));
216216
}

src/Symfony/Component/HttpFoundation/Tests/RequestTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1565,7 +1565,6 @@ public function testGetLanguages()
15651565
$request = new Request();
15661566
$request->headers->set('Accept-language', 'zh, en-us; q=0.8, en; q=0.6');
15671567
$this->assertEquals(['zh', 'en_US', 'en'], $request->getLanguages());
1568-
$this->assertEquals(['zh', 'en_US', 'en'], $request->getLanguages());
15691568

15701569
$request = new Request();
15711570
$request->headers->set('Accept-language', 'zh, en-us; q=0.6, en; q=0.8');

src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,6 @@ public function testPrepareRemovesContentForInformationalResponse()
534534
$response->prepare($request);
535535
$this->assertEquals('', $response->getContent());
536536
$this->assertFalse($response->headers->has('Content-Type'));
537-
$this->assertFalse($response->headers->has('Content-Type'));
538537

539538
$response->setContent('content');
540539
$response->setStatusCode(304);

src/Symfony/Component/Intl/Data/Generator/LanguageDataGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
class LanguageDataGenerator extends AbstractDataGenerator
2828
{
2929
/**
30-
* Source: https://iso639-3.sil.org/code_tables/639/data
30+
* Source: https://iso639-3.sil.org/code_tables/639/data.
3131
*/
3232
private static $preferredAlpha2ToAlpha3Mapping = [
3333
'ak' => 'aka',

src/Symfony/Component/Intl/Data/Generator/RegionDataGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
class RegionDataGenerator extends AbstractDataGenerator
2929
{
3030
/**
31-
* Source https://www.iso.org/obp/ui/#iso:pub:PUB500001:en
31+
* Source: https://www.iso.org/obp/ui/#iso:pub:PUB500001:en.
3232
*/
3333
private static $preferredAlpha2ToAlpha3Mapping = [
3434
'DE' => 'DEU',

src/Symfony/Component/Security/Core/Resources/translations/security.fa.xlf

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@
3030
<source>Invalid CSRF token.</source>
3131
<target>توکن CSRF معتبر نمی باشد.</target>
3232
</trans-unit>
33-
<trans-unit id="8">
34-
<source>Digest nonce has expired.</source>
35-
<target>Digest nonce منقضی گردیده است.</target>
36-
</trans-unit>
3733
<trans-unit id="9">
3834
<source>No authentication provider found to support the authentication token.</source>
3935
<target>هیچ ارایه دهنده احراز هویتی برای پشتیبانی از توکن احراز هویت پیدا نشد.</target>

src/Symfony/Component/Translation/Resources/bin/translation-status.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,9 @@ function printTable($translations, $verboseOutput)
167167
$longestLocaleNameLength = max(array_map('strlen', array_keys($translations)));
168168

169169
foreach ($translations as $locale => $translation) {
170-
$isTranslationCompleted = $translation['translated'] === $translation['total'];
171-
if ($isTranslationCompleted) {
170+
if ($translation['translated'] > $translation['total']) {
171+
textColorRed();
172+
} elseif ($translation['translated'] === $translation['total']) {
172173
textColorGreen();
173174
}
174175

@@ -194,6 +195,11 @@ function textColorGreen()
194195
echo "\033[32m";
195196
}
196197

198+
function textColorRed()
199+
{
200+
echo "\033[31m";
201+
}
202+
197203
function textColorNormal()
198204
{
199205
echo "\033[0m";

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

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,74 @@
298298
<source>The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed.</source>
299299
<target>Слика је оријантације портрета ({{ width }}x{{ height }}px). Портретна оријентација слика није дозвољена.</target>
300300
</trans-unit>
301+
<trans-unit id="78">
302+
<source>An empty file is not allowed.</source>
303+
<target>Празна датотека није дозвољена.</target>
304+
</trans-unit>
305+
<trans-unit id="79">
306+
<source>The host could not be resolved.</source>
307+
<target>Није могуће одредити послужитеља.</target>
308+
</trans-unit>
309+
<trans-unit id="80">
310+
<source>This value does not match the expected {{ charset }} charset.</source>
311+
<target>Вредност се не поклапа са очекиваним {{ charset }} сетом карактера.</target>
312+
</trans-unit>
313+
<trans-unit id="81">
314+
<source>This is not a valid Business Identifier Code (BIC).</source>
315+
<target>Ово није валидан међународни идентификацијски код банке (BIC).</target>
316+
</trans-unit>
317+
<trans-unit id="82">
318+
<source>Error</source>
319+
<target>Грешка</target>
320+
</trans-unit>
321+
<trans-unit id="83">
322+
<source>This is not a valid UUID.</source>
323+
<target>Ово није валидан универзални уникатни идентификатор (UUID).</target>
324+
</trans-unit>
325+
<trans-unit id="84">
326+
<source>This value should be a multiple of {{ compared_value }}.</source>
327+
<target>Ова вредност би требало да буде дељива са {{ compared_value }}.</target>
328+
</trans-unit>
329+
<trans-unit id="85">
330+
<source>This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.</source>
331+
<target>BIC код није повезан са IBAN {{ iban }}.</target>
332+
</trans-unit>
333+
<trans-unit id="86">
334+
<source>This value should be valid JSON.</source>
335+
<target>Ова вредност би требало да буде валидан JSON.</target>
336+
</trans-unit>
337+
<trans-unit id="87">
338+
<source>This collection should contain only unique elements.</source>
339+
<target>Ова колекција би требала да садржи само јединствене елементе.</target>
340+
</trans-unit>
341+
<trans-unit id="88">
342+
<source>This value should be positive.</source>
343+
<target>Ова вредност би требала бити позитивна.</target>
344+
</trans-unit>
345+
<trans-unit id="89">
346+
<source>This value should be either positive or zero.</source>
347+
<target>Ова вредност би требала бити позитивна или нула.</target>
348+
</trans-unit>
349+
<trans-unit id="90">
350+
<source>This value should be negative.</source>
351+
<target>Ова вредност би требала бити негативна.</target>
352+
</trans-unit>
353+
<trans-unit id="91">
354+
<source>This value should be either negative or zero.</source>
355+
<target>Ова вредност би требала бити позитивна или нула.</target>
356+
</trans-unit>
357+
<trans-unit id="92">
358+
<source>This value is not a valid timezone.</source>
359+
<target>Ова вредност није валидна временска зона.</target>
360+
</trans-unit>
361+
<trans-unit id="93">
362+
<source>This password has been leaked in a data breach, it must not be used. Please use another password.</source>
363+
<target>Ова лозинка је компромитована приликом претходних напада, немојте је користити. Користите другу лозинку.</target>
364+
</trans-unit>
365+
<trans-unit id="94">
366+
<source>This value should be between {{ min }} and {{ max }}.</source>
367+
<target>Ова вредност треба да буде између {{ min }} и {{ max }}.</target>
368+
</trans-unit>
301369
</body>
302370
</file>
303371
</xliff>

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

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,38 @@
334334
<source>This value should be valid JSON.</source>
335335
<target>Ova vrednost bi trebalo da bude validan JSON.</target>
336336
</trans-unit>
337+
<trans-unit id="87">
338+
<source>This collection should contain only unique elements.</source>
339+
<target>Ova kolekcija bi trebala da sadrži samo jedinstvene elemente.</target>
340+
</trans-unit>
341+
<trans-unit id="88">
342+
<source>This value should be positive.</source>
343+
<target>Ova vrednost bi trebala biti pozitivna.</target>
344+
</trans-unit>
345+
<trans-unit id="89">
346+
<source>This value should be either positive or zero.</source>
347+
<target>Ova vrednost bi trebala biti pozitivna ili nula.</target>
348+
</trans-unit>
349+
<trans-unit id="90">
350+
<source>This value should be negative.</source>
351+
<target>Ova vrednost bi trebala biti negativna.</target>
352+
</trans-unit>
353+
<trans-unit id="91">
354+
<source>This value should be either negative or zero.</source>
355+
<target>Ova vrednost bi trebala biti pozitivna ili nula.</target>
356+
</trans-unit>
357+
<trans-unit id="92">
358+
<source>This value is not a valid timezone.</source>
359+
<target>Ova vrednost nije validna vremenska zona.</target>
360+
</trans-unit>
361+
<trans-unit id="93">
362+
<source>This password has been leaked in a data breach, it must not be used. Please use another password.</source>
363+
<target>Ova lozinka je kompromitovana prilikom prethodnih napada, nemojte je koristiti. Koristite drugu lozinku.</target>
364+
</trans-unit>
365+
<trans-unit id="94">
366+
<source>This value should be between {{ min }} and {{ max }}.</source>
367+
<target>Ova vrednost treba da bude između {{ min }} i {{ max }}.</target>
368+
</trans-unit>
337369
</body>
338370
</file>
339371
</xliff>

0 commit comments

Comments
 (0)
0