Skip to content

Commit 48872f3

Browse 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

File tree

24 files changed

+777
-28
lines changed

24 files changed

+777
-28
lines changed

.github/build-packages.php

Lines 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

Lines 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

Lines 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

Lines 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

Lines 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

Lines 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

Lines 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

Lines 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

Lines 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

Lines 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 {

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