Skip to content

Commit dd32dab

Browse files
Merge branch '3.4' into 4.0
* 3.4: [HttpKernel] DebugHandlersListener should always replace the existing exception handler fix the Composer API being used [Security] Notify that symfony/expression-language is not installed if ExpressionLanguage and ExpressionLanguagePrivider are 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 Avoid button label translation when it's set to false 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) Fix options resolver with array allowed types [Console] Improve phpdoc on StyleInterface::ask() [TwigBridge][WIP] Pass the form-check-inline in parent
2 parents e6157aa + 5f75d43 commit dd32dab

File tree

33 files changed

+771
-52
lines changed

33 files changed

+771
-52
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/Bridge/Twig/Resources/views/Form/bootstrap_4_layout.html.twig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@
7474
{%- set attr = attr|merge({class: (attr.class|default('') ~ ' form-check-input')|trim}) -%}
7575
{% if 'checkbox-inline' in parent_label_class %}
7676
{{- form_label(form, null, { widget: parent() }) -}}
77+
{% elseif 'form-check-inline' in parent_label_class %}
78+
<div class="form-check{{ not valid ? ' form-control is-invalid' }} form-check-inline">
79+
{{- form_label(form, null, { widget: parent() }) -}}
80+
</div>
7781
{% else -%}
7882
<div class="form-check{{ not valid ? ' form-control is-invalid' }}">
7983
{{- form_label(form, null, { widget: parent() }) -}}

src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,12 +216,14 @@
216216
{%- endblock range_widget %}
217217

218218
{%- block button_widget -%}
219-
{%- if label is not same as(false) and label is empty -%}
219+
{%- if label is empty -%}
220220
{%- if label_format is not empty -%}
221221
{% set label = label_format|replace({
222222
'%name%': name,
223223
'%id%': id,
224224
}) %}
225+
{%- elseif label is same as(false) -%}
226+
{% set translation_domain = false %}
225227
{%- else -%}
226228
{% set label = name|humanize %}
227229
{%- endif -%}

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
@@ -208,6 +208,20 @@ public function testCanBeDisabled()
208208
$this->assertTrue($this->getField($enabledNode, 'defaultValue'));
209209
}
210210

211+
public function testEnableableNodeIsDisabledForEmptyConfigurationWhenNormalized()
212+
{
213+
$config = array();
214+
215+
$node = new ArrayNodeDefinition('root');
216+
$node->canBeEnabled();
217+
218+
$this->assertEquals(
219+
array('enabled' => false),
220+
$node->getNode()->normalize($config),
221+
'An enableable node is disabled by default'
222+
);
223+
}
224+
211225
public function testIgnoreExtraKeys()
212226
{
213227
$node = new ArrayNodeDefinition('root');
@@ -283,6 +297,7 @@ public function getEnableableNodeFixtures()
283297
array(array('enabled' => true, 'foo' => 'baz'), array(array('foo' => 'baz')), 'any configuration enables an enableable node'),
284298
array(array('enabled' => false, 'foo' => 'baz'), array(array('foo' => 'baz', 'enabled' => false)), 'An enableable node can be disabled'),
285299
array(array('enabled' => false, 'foo' => 'bar'), array(false), 'false disables an enableable node'),
300+
array(array('enabled' => false, 'foo' => 'bar'), array(), 'enableable node is disabled by default'),
286301
);
287302
}
288303

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

0 commit comments

Comments
 (0)