Skip to content

Commit 5f75d43

Browse files
Merge branch '3.3' into 3.4
* 3.3: [HttpKernel] DebugHandlersListener should always replace the existing exception handler 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 [Cache] Fix handling of apcu_fetch() edgy behavior Add nn (Norwegian Nynorsk) translation files, and improve existing file Problem in phar see mergerequest symfony#25579 [Form] Disallow transform dates beyond the year 9999 Copied NO language files to the new NB locale. [Serializer] DateTimeNormalizer handling of null and empty values (returning null or empty instead of new object) [Console] Improve phpdoc on StyleInterface::ask()
2 parents 67e3879 + 5d99964 commit 5f75d43

File tree

30 files changed

+743
-36
lines changed

30 files changed

+743
-36
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'});

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ install:
195195
elif [[ $deps = low ]]; then
196196
echo "$COMPONENTS" | parallel --gnu -j10% "tfold {} 'cd {} && $COMPOSER_UP --prefer-lowest --prefer-stable && $PHPUNIT_X'"
197197
elif [[ $PHP = hhvm* ]]; then
198-
$PHPUNIT --exclude-group benchmark,intl-data
198+
$PHPUNIT --exclude-group no-hhvm,benchmark,intl-data
199199
else
200200
echo "$COMPONENTS" | parallel --gnu "tfold {} $PHPUNIT_X {}"
201201
tfold tty-group $PHPUNIT --group tty

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,11 @@ public function process(ContainerBuilder $container)
7575

7676
if ($container->getParameter('kernel.debug')) {
7777
$container->getDefinition('twig.extension.profiler')->addTag('twig.extension');
78-
$container->getDefinition('twig.extension.debug')->addTag('twig.extension');
78+
79+
// only register if the improved version from DebugBundle is *not* present
80+
if (!$container->has('twig.extension.dump')) {
81+
$container->getDefinition('twig.extension.debug')->addTag('twig.extension');
82+
}
7983
}
8084

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

src/Symfony/Component/Cache/Tests/Adapter/ApcuAdapterTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function createCachePool($defaultLifetime = 0)
2929
}
3030
if ('cli' === PHP_SAPI && !ini_get('apc.enable_cli')) {
3131
if ('testWithCliSapi' !== $this->getName()) {
32-
$this->markTestSkipped('APCu extension is required.');
32+
$this->markTestSkipped('apc.enable_cli=1 is required.');
3333
}
3434
}
3535
if ('\\' === DIRECTORY_SEPARATOR) {

src/Symfony/Component/Cache/Traits/ApcuTrait.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,11 @@ private function init($namespace, $defaultLifetime, $version)
5252
protected function doFetch(array $ids)
5353
{
5454
try {
55-
return apcu_fetch($ids) ?: array();
55+
foreach (apcu_fetch($ids, $ok) ?: array() as $k => $v) {
56+
if (null !== $v || $ok) {
57+
yield $k => $v;
58+
}
59+
}
5660
} catch (\Error $e) {
5761
throw new \ErrorException($e->getMessage(), $e->getCode(), E_ERROR, $e->getFile(), $e->getLine());
5862
}

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,9 @@ public function canBeEnabled()
283283
->beforeNormalization()
284284
->ifArray()
285285
->then(function ($v) {
286-
$v['enabled'] = isset($v['enabled']) ? $v['enabled'] : true;
286+
if (!isset($v['enabled'])) {
287+
$v['enabled'] = !empty($v);
288+
}
287289

288290
return $v;
289291
})

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');
@@ -282,6 +296,7 @@ public function getEnableableNodeFixtures()
282296
array(array('enabled' => true, 'foo' => 'baz'), array(array('foo' => 'baz')), 'any configuration enables an enableable node'),
283297
array(array('enabled' => false, 'foo' => 'baz'), array(array('foo' => 'baz', 'enabled' => false)), 'An enableable node can be disabled'),
284298
array(array('enabled' => false, 'foo' => 'bar'), array(false), 'false disables an enableable node'),
299+
array(array('enabled' => false, 'foo' => 'bar'), array(), 'enableable node is disabled by default'),
285300
);
286301
}
287302

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
@@ -279,7 +279,7 @@ public function createProgressBar($max = 0)
279279
}
280280

281281
/**
282-
* @return string
282+
* @return mixed
283283
*/
284284
public function askQuestion(Question $question)
285285
{

0 commit comments

Comments
 (0)