Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 48872f3

Browse filesBrowse files
committed
Merge branch '2.7' into 2.8
* 2.7: fix the Composer API being used [Debug] Always decorate existing exception handlers to deal with fatal errors Enableable ArrayNodeDefinition is disabled for empty configuration Fixing a bug where the dump() function depended on bundle ordering Add nn (Norwegian Nynorsk) translation files, and improve existing file Problem in phar see mergerequest #25579 [Form] Disallow transform dates beyond the year 9999 Copied NO language files to the new NB locale. [Console] Improve phpdoc on StyleInterface::ask()
2 parents 899bf99 + 78a8a63 commit 48872f3
Copy full SHA for 48872f3

File tree

Expand file treeCollapse file tree

24 files changed

+777
-28
lines changed
Filter options
Expand file treeCollapse file tree

24 files changed

+777
-28
lines changed

‎.github/build-packages.php

Copy file name to clipboardExpand all lines: .github/build-packages.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@
4949

5050
$packages[$package->name][$package->version] = $package;
5151

52-
$versions = file_get_contents('https://packagist.org/packages/'.$package->name.'.json');
53-
$versions = json_decode($versions)->package->versions;
52+
$versions = file_get_contents('https://packagist.org/p/'.$package->name.'.json');
53+
$versions = json_decode($versions)->packages->{$package->name};
5454

5555
if ($package->version === str_replace('-dev', '.x-dev', $versions->{'dev-master'}->extra->{'branch-alias'}->{'dev-master'})) {
5656
unset($versions->{'dev-master'});

‎src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/ExtensionPass.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/ExtensionPass.php
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,11 @@ public function process(ContainerBuilder $container)
9292

9393
if ($container->getParameter('kernel.debug')) {
9494
$container->getDefinition('twig.extension.profiler')->addTag('twig.extension');
95-
$container->getDefinition('twig.extension.debug')->addTag('twig.extension');
95+
96+
// only register if the improved version from DebugBundle is *not* present
97+
if (!$container->has('twig.extension.dump')) {
98+
$container->getDefinition('twig.extension.debug')->addTag('twig.extension');
99+
}
96100
}
97101

98102
$twigLoader = $container->getDefinition('twig.loader.native_filesystem');

‎src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,9 @@ public function canBeEnabled()
227227
->beforeNormalization()
228228
->ifArray()
229229
->then(function ($v) {
230-
$v['enabled'] = isset($v['enabled']) ? $v['enabled'] : true;
230+
if (!isset($v['enabled'])) {
231+
$v['enabled'] = !empty($v);
232+
}
231233

232234
return $v;
233235
})

‎src/Symfony/Component/Config/Tests/Definition/Builder/ArrayNodeDefinitionTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Config/Tests/Definition/Builder/ArrayNodeDefinitionTest.php
+15Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,20 @@ public function testCanBeDisabled()
207207
$this->assertTrue($this->getField($enabledNode, 'defaultValue'));
208208
}
209209

210+
public function testEnableableNodeIsDisabledForEmptyConfigurationWhenNormalized()
211+
{
212+
$config = array();
213+
214+
$node = new ArrayNodeDefinition('root');
215+
$node->canBeEnabled();
216+
217+
$this->assertEquals(
218+
array('enabled' => false),
219+
$node->getNode()->normalize($config),
220+
'An enableable node is disabled by default'
221+
);
222+
}
223+
210224
public function testIgnoreExtraKeys()
211225
{
212226
$node = new ArrayNodeDefinition('root');
@@ -240,6 +254,7 @@ public function getEnableableNodeFixtures()
240254
array(array('enabled' => true, 'foo' => 'baz'), array(array('foo' => 'baz')), 'any configuration enables an enableable node'),
241255
array(array('enabled' => false, 'foo' => 'baz'), array(array('foo' => 'baz', 'enabled' => false)), 'An enableable node can be disabled'),
242256
array(array('enabled' => false, 'foo' => 'bar'), array(false), 'false disables an enableable node'),
257+
array(array('enabled' => false, 'foo' => 'bar'), array(), 'enableable node is disabled by default'),
243258
);
244259
}
245260

‎src/Symfony/Component/Config/Tests/Definition/Builder/TreeBuilderTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Config/Tests/Definition/Builder/TreeBuilderTest.php
+19Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\Config\Tests\Definition\Builder;
1313

1414
use PHPUnit\Framework\TestCase;
15+
use Symfony\Component\Config\Definition\Processor;
1516
use Symfony\Component\Config\Tests\Fixtures\Builder\NodeBuilder as CustomNodeBuilder;
1617
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
1718

@@ -131,4 +132,22 @@ public function testDefinitionExampleGetsTransferredToNode()
131132
$this->assertInternalType('array', $tree->getExample());
132133
$this->assertEquals('example', $children['child']->getExample());
133134
}
135+
136+
public function testRootNodeThatCanBeEnabledIsDisabledByDefault()
137+
{
138+
$builder = new TreeBuilder();
139+
140+
$builder->root('test')
141+
->canBeEnabled();
142+
143+
$tree = $builder->buildTree();
144+
$children = $tree->getChildren();
145+
146+
$this->assertFalse($children['enabled']->getDefaultValue());
147+
148+
$processor = new Processor();
149+
$result = $processor->process($tree, array());
150+
151+
$this->assertEquals(array('enabled' => false), $result);
152+
}
134153
}

‎src/Symfony/Component/Console/Style/StyleInterface.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Style/StyleInterface.php
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public function table(array $headers, array $rows);
9191
* @param string|null $default
9292
* @param callable|null $validator
9393
*
94-
* @return string
94+
* @return mixed
9595
*/
9696
public function ask($question, $default = null, $validator = null);
9797

@@ -101,7 +101,7 @@ public function ask($question, $default = null, $validator = null);
101101
* @param string $question
102102
* @param callable|null $validator
103103
*
104-
* @return string
104+
* @return mixed
105105
*/
106106
public function askHidden($question, $validator = null);
107107

@@ -122,7 +122,7 @@ public function confirm($question, $default = true);
122122
* @param array $choices
123123
* @param string|int|null $default
124124
*
125-
* @return string
125+
* @return mixed
126126
*/
127127
public function choice($question, array $choices, $default = null);
128128

‎src/Symfony/Component/Console/Style/SymfonyStyle.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Style/SymfonyStyle.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ public function createProgressBar($max = 0)
281281
}
282282

283283
/**
284-
* @return string
284+
* @return mixed
285285
*/
286286
public function askQuestion(Question $question)
287287
{

‎src/Symfony/Component/Debug/ErrorHandler.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Debug/ErrorHandler.php
+6-3Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,14 @@ public static function register($handler = null, $replace = true)
149149
$handler = $prev[0];
150150
$replace = false;
151151
}
152-
if ($replace || !$prev) {
153-
$handler->setExceptionHandler(set_exception_handler(array($handler, 'handleException')));
154-
} else {
152+
if (!$replace && $prev) {
155153
restore_error_handler();
156154
}
155+
if (is_array($prev = set_exception_handler(array($handler, 'handleException'))) && $prev[0] === $handler) {
156+
restore_exception_handler();
157+
} else {
158+
$handler->setExceptionHandler($prev);
159+
}
157160

158161
$handler->throwAt($levels & $handler->thrownErrors, true);
159162

‎src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,16 +481,20 @@ public function validateSchema(\DOMDocument $dom)
481481
$imports = '';
482482
foreach ($schemaLocations as $namespace => $location) {
483483
$parts = explode('/', $location);
484+
$locationstart = 'file:///';
484485
if (0 === stripos($location, 'phar://')) {
485486
$tmpfile = tempnam(sys_get_temp_dir(), 'sf2');
486487
if ($tmpfile) {
487488
copy($location, $tmpfile);
488489
$tmpfiles[] = $tmpfile;
489490
$parts = explode('/', str_replace('\\', '/', $tmpfile));
491+
} else {
492+
array_shift($parts);
493+
$locationstart = 'phar:///';
490494
}
491495
}
492496
$drive = '\\' === DIRECTORY_SEPARATOR ? array_shift($parts).'/' : '';
493-
$location = 'file:///'.$drive.implode('/', array_map('rawurlencode', $parts));
497+
$location = $locationstart.$drive.implode('/', array_map('rawurlencode', $parts));
494498

495499
$imports .= sprintf(' <xsd:import namespace="%s" schemaLocation="%s" />'."\n", $namespace, $location);
496500
}

‎src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformer.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformer.php
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@ public function reverseTransform($value)
123123

124124
if (0 != intl_get_error_code()) {
125125
throw new TransformationFailedException(intl_get_error_message());
126+
} elseif ($timestamp > 253402214400) {
127+
// This timestamp represents UTC midnight of 9999-12-31 to prevent 5+ digit years
128+
throw new TransformationFailedException('Years beyond 9999 are not supported.');
126129
}
127130

128131
try {
+19Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0"?>
2+
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
3+
<file source-language="en" datatype="plaintext" original="file.ext">
4+
<body>
5+
<trans-unit id="28">
6+
<source>This form should not contain extra fields.</source>
7+
<target>Feltgruppen må ikke inneholde ekstra felter.</target>
8+
</trans-unit>
9+
<trans-unit id="29">
10+
<source>The uploaded file was too large. Please try to upload a smaller file.</source>
11+
<target>Den opplastede filen var for stor. Vennligst last opp en mindre fil.</target>
12+
</trans-unit>
13+
<trans-unit id="30">
14+
<source>The CSRF token is invalid.</source>
15+
<target>CSRF nøkkelen er ugyldig.</target>
16+
</trans-unit>
17+
</body>
18+
</file>
19+
</xliff>
+19Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0"?>
2+
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
3+
<file source-language="en" datatype="plaintext" original="file.ext">
4+
<body>
5+
<trans-unit id="28">
6+
<source>This form should not contain extra fields.</source>
7+
<target>Feltgruppa må ikkje innehalde ekstra felt.</target>
8+
</trans-unit>
9+
<trans-unit id="29">
10+
<source>The uploaded file was too large. Please try to upload a smaller file.</source>
11+
<target>Fila du lasta opp var for stor. Last opp ei mindre fil.</target>
12+
</trans-unit>
13+
<trans-unit id="30">
14+
<source>The CSRF token is invalid.</source>
15+
<target>CSRF-nøkkelen er ikkje gyldig.</target>
16+
</trans-unit>
17+
</body>
18+
</file>
19+
</xliff>

‎src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformerTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformerTest.php
+18Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,4 +343,22 @@ public function testReverseTransformOutOfTimestampRange()
343343
$transformer = new DateTimeToLocalizedStringTransformer('UTC', 'UTC');
344344
$transformer->reverseTransform('1789-07-14');
345345
}
346+
347+
/**
348+
* @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
349+
*/
350+
public function testReverseTransformFiveDigitYears()
351+
{
352+
$transformer = new DateTimeToLocalizedStringTransformer('UTC', 'UTC', null, null, \IntlDateFormatter::GREGORIAN, 'yyyy-MM-dd');
353+
$transformer->reverseTransform('20107-03-21');
354+
}
355+
356+
/**
357+
* @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
358+
*/
359+
public function testReverseTransformFiveDigitYearsWithTimestamp()
360+
{
361+
$transformer = new DateTimeToLocalizedStringTransformer('UTC', 'UTC', null, null, \IntlDateFormatter::GREGORIAN, 'yyyy-MM-dd HH:mm:ss');
362+
$transformer->reverseTransform('20107-03-21 12:34:56');
363+
}
346364
}

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Tests/Resources/TranslationFilesTest.php
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,13 @@ function ($filePath) { return (array) $filePath; },
3636
glob(dirname(dirname(__DIR__)).'/Resources/translations/*.xlf')
3737
);
3838
}
39+
40+
public function testNorwegianAlias()
41+
{
42+
$this->assertFileEquals(
43+
dirname(dirname(__DIR__)).'/Resources/translations/validators.nb.xlf',
44+
dirname(dirname(__DIR__)).'/Resources/translations/validators.no.xlf',
45+
'The NO locale should be an alias for the NB variant of the Norwegian language.'
46+
);
47+
}
3948
}
+71Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<?xml version="1.0"?>
2+
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
3+
<file source-language="en" datatype="plaintext" original="file.ext">
4+
<body>
5+
<trans-unit id="1">
6+
<source>An authentication exception occurred.</source>
7+
<target>En autentiseringsfeil har skjedd.</target>
8+
</trans-unit>
9+
<trans-unit id="2">
10+
<source>Authentication credentials could not be found.</source>
11+
<target>Påloggingsinformasjonen kunne ikke bli funnet.</target>
12+
</trans-unit>
13+
<trans-unit id="3">
14+
<source>Authentication request could not be processed due to a system problem.</source>
15+
<target>Autentiserings forespørselen kunne ikke bli prosessert grunnet en system feil.</target>
16+
</trans-unit>
17+
<trans-unit id="4">
18+
<source>Invalid credentials.</source>
19+
<target>Ugyldig påloggingsinformasjonen.</target>
20+
</trans-unit>
21+
<trans-unit id="5">
22+
<source>Cookie has already been used by someone else.</source>
23+
<target>Cookie har allerede blitt brukt av noen andre.</target>
24+
</trans-unit>
25+
<trans-unit id="6">
26+
<source>Not privileged to request the resource.</source>
27+
<target>Ingen tilgang til å be om gitt ressurs.</target>
28+
</trans-unit>
29+
<trans-unit id="7">
30+
<source>Invalid CSRF token.</source>
31+
<target>Ugyldig CSRF token.</target>
32+
</trans-unit>
33+
<trans-unit id="8">
34+
<source>Digest nonce has expired.</source>
35+
<target>Digest nonce er utløpt.</target>
36+
</trans-unit>
37+
<trans-unit id="9">
38+
<source>No authentication provider found to support the authentication token.</source>
39+
<target>Ingen autentiserings tilbyder funnet som støtter gitt autentiserings token.</target>
40+
</trans-unit>
41+
<trans-unit id="10">
42+
<source>No session available, it either timed out or cookies are not enabled.</source>
43+
<target>Ingen sesjon tilgjengelig, sesjonen er enten utløpt eller cookies ikke skrudd på.</target>
44+
</trans-unit>
45+
<trans-unit id="11">
46+
<source>No token could be found.</source>
47+
<target>Ingen token kunne bli funnet.</target>
48+
</trans-unit>
49+
<trans-unit id="12">
50+
<source>Username could not be found.</source>
51+
<target>Brukernavn kunne ikke bli funnet.</target>
52+
</trans-unit>
53+
<trans-unit id="13">
54+
<source>Account has expired.</source>
55+
<target>Brukerkonto har utgått.</target>
56+
</trans-unit>
57+
<trans-unit id="14">
58+
<source>Credentials have expired.</source>
59+
<target>Påloggingsinformasjon har utløpt.</target>
60+
</trans-unit>
61+
<trans-unit id="15">
62+
<source>Account is disabled.</source>
63+
<target>Brukerkonto er deaktivert.</target>
64+
</trans-unit>
65+
<trans-unit id="16">
66+
<source>Account is locked.</source>
67+
<target>Brukerkonto er sperret.</target>
68+
</trans-unit>
69+
</body>
70+
</file>
71+
</xliff>

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.