Skip to content

Commit f718eec

Browse files
Merge branch '3.0'
* 3.0: (105 commits) [Console] remove readline support bumped Symfony version to 3.0.3 updated VERSION for 3.0.2 updated CHANGELOG for 3.0.2 [Routing] added a suggestion to add the HttpFoundation component. [FrameworkBundle] fix assets and templating tests [ClassLoader] fix ApcClassLoader tests on HHVM [travis] Add some comments changed operator from and to && [DependencyInjection] Remove unused parameter [Process] Fix transient tests for incremental outputs [Console] Add missing `@require` annotation in test Fix merge [appveyor] Fix failure reporting [#17634] move DebugBundle license file Limit Ldap component version for the 3.0 branch backport GlobTest from 2.7 branch Move licenses according to new best practices [FrameworkBundle] Remove unused code in test [2.3] Fixed an undefined variable in Glob::toRegex ... Conflicts: .travis.yml composer.json src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/assets.php src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/assets.xml src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/assets.yml src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_item.html.twig src/Symfony/Component/Console/CHANGELOG.md src/Symfony/Component/HttpKernel/Kernel.php src/Symfony/Component/PropertyInfo/Tests/PropertyInfoExtractorTest.php src/Symfony/Component/Yaml/Tests/ParserTest.php
2 parents 9393466 + 67b0b9e commit f718eec

19 files changed

+105
-79
lines changed

Command/AbstractConfigCommand.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,13 @@ protected function listBundles($output)
2929
{
3030
$headers = array('Bundle name', 'Extension alias');
3131
$rows = array();
32-
foreach ($this->getContainer()->get('kernel')->getBundles() as $bundle) {
32+
33+
$bundles = $this->getContainer()->get('kernel')->getBundles();
34+
usort($bundles, function($bundleA, $bundleB) {
35+
return strcmp($bundleA->getName(), $bundleB->getName());
36+
});
37+
38+
foreach ($bundles as $bundle) {
3339
$extension = $bundle->getContainerExtension();
3440
$rows[] = array($bundle->getName(), $extension ? $extension->getAlias() : '');
3541
}
@@ -48,6 +54,10 @@ protected function findExtension($name)
4854
$bundles = $this->initializeBundles();
4955
foreach ($bundles as $bundle) {
5056
if ($name === $bundle->getName()) {
57+
if (!$bundle->getContainerExtension()) {
58+
throw new \LogicException(sprintf('Bundle "%s" does not have a container extension.', $name));
59+
}
60+
5161
return $bundle->getContainerExtension();
5262
}
5363

Command/ConfigDebugCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
8585
$io->title(sprintf('Current configuration for "%s"', $name));
8686
}
8787

88-
$io->writeln(Yaml::dump(array($extension->getAlias() => $config), 3));
88+
$io->writeln(Yaml::dump(array($extension->getAlias() => $config), 10));
8989
}
9090

9191
private function compileContainer()

Command/TranslationUpdateCommand.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
150150
return;
151151
}
152152

153+
$resultMessage = 'Translation files were successfully updated';
154+
153155
// show compiled list of messages
154156
if (true === $input->getOption('dump-messages')) {
155157
$extractedMessagesCount = 0;
@@ -204,12 +206,10 @@ protected function execute(InputInterface $input, OutputInterface $output)
204206
$writer->writeTranslations($operation->getResult(), $input->getOption('output-format'), array('path' => $bundleTransPath, 'default_locale' => $this->getContainer()->getParameter('kernel.default_locale')));
205207

206208
if (true === $input->getOption('dump-messages')) {
207-
$resultMessage .= ' and translation files were updated.';
208-
} else {
209-
$resultMessage = 'Translation files were successfully updated.';
209+
$resultMessage .= ' and translation files were updated';
210210
}
211211
}
212212

213-
$io->success($resultMessage);
213+
$io->success($resultMessage.'.');
214214
}
215215
}

DependencyInjection/Configuration.php

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@ public function getConfigTreeBuilder()
4343
$rootNode = $treeBuilder->root('framework');
4444

4545
$rootNode
46+
->beforeNormalization()
47+
->ifTrue(function ($v) { return !isset($v['assets']) && isset($v['templating']); })
48+
->then(function ($v) {
49+
$v['assets'] = array();
50+
51+
return $v;
52+
})
53+
->end()
4654
->children()
4755
->scalarNode('secret')->end()
4856
->scalarNode('http_method_override')
@@ -62,6 +70,10 @@ public function getConfigTreeBuilder()
6270
}
6371

6472
if (false !== strpos($v, '/')) {
73+
if ('0.0.0.0/0' === $v) {
74+
return false;
75+
}
76+
6577
list($v, $mask) = explode('/', $v, 2);
6678

6779
if (strcmp($mask, (int) $mask) || $mask < 1 || $mask > (false !== strpos($v, ':') ? 128 : 32)) {
@@ -379,7 +391,7 @@ private function addAssetsSection(ArrayNodeDefinition $rootNode)
379391
->end()
380392
->validate()
381393
->ifTrue(function ($v) {
382-
return (null !== $v['version_strategy'] && null !== $v['version']);
394+
return isset($v['version_strategy']) && isset($v['version']);
383395
})
384396
->thenInvalid('You cannot use both "version_strategy" and "version" at the same time under "assets".')
385397
->end()
@@ -391,7 +403,12 @@ private function addAssetsSection(ArrayNodeDefinition $rootNode)
391403
->fixXmlConfig('base_url')
392404
->children()
393405
->scalarNode('version_strategy')->defaultNull()->end()
394-
->scalarNode('version')->defaultNull()->end()
406+
->scalarNode('version')
407+
->beforeNormalization()
408+
->ifTrue(function ($v) { return '' === $v; })
409+
->then(function ($v) { return; })
410+
->end()
411+
->end()
395412
->scalarNode('version_format')->defaultNull()->end()
396413
->scalarNode('base_path')->defaultValue('')->end()
397414
->arrayNode('base_urls')
@@ -405,7 +422,7 @@ private function addAssetsSection(ArrayNodeDefinition $rootNode)
405422
->end()
406423
->validate()
407424
->ifTrue(function ($v) {
408-
return (null !== $v['version_strategy'] && null !== $v['version']);
425+
return isset($v['version_strategy']) && isset($v['version']);
409426
})
410427
->thenInvalid('You cannot use both "version_strategy" and "version" at the same time under "assets" packages.')
411428
->end()
@@ -450,20 +467,7 @@ private function addValidationSection(ArrayNodeDefinition $rootNode)
450467
->info('validation configuration')
451468
->canBeEnabled()
452469
->children()
453-
->scalarNode('cache')
454-
->beforeNormalization()
455-
// Can be removed in 3.0, once ApcCache support is dropped
456-
->ifString()->then(function ($v) {
457-
if ('apc' === $v) {
458-
@trigger_error('The ability to pass "apc" as the framework.validation.cache configuration key value is deprecated since version 2.8 and will be removed in 3.0. Use the "validator.mapping.cache.doctrine.apc" service id instead.', E_USER_DEPRECATED);
459-
460-
return 'validator.mapping.cache.apc';
461-
}
462-
463-
return $v;
464-
})
465-
->end()
466-
->end()
470+
->scalarNode('cache')->end()
467471
->booleanNode('enable_annotations')->defaultFalse()->end()
468472
->arrayNode('static_method')
469473
->defaultValue(array('loadValidatorMetadata'))

DependencyInjection/FrameworkExtension.php

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ class FrameworkExtension extends Extension
3838
private $translationConfigEnabled = false;
3939
private $sessionConfigEnabled = false;
4040

41+
/**
42+
* @var string|null
43+
*/
44+
private $kernelRootHash;
45+
4146
/**
4247
* Responds to the app.config configuration parameter.
4348
*
@@ -542,11 +547,7 @@ private function registerTemplatingConfiguration(array $config, $ide, ContainerB
542547
'Symfony\\Bundle\\FrameworkBundle\\Templating\\Loader\\FilesystemLoader',
543548
));
544549

545-
if ($container->hasDefinition('assets.packages')) {
546-
$container->getDefinition('templating.helper.assets')->replaceArgument(0, new Reference('assets.packages'));
547-
} else {
548-
$container->removeDefinition('templating.helper.assets');
549-
}
550+
$container->getDefinition('templating.helper.assets')->replaceArgument(0, new Reference('assets.packages'));
550551
}
551552
}
552553

@@ -576,7 +577,7 @@ private function registerAssetsConfiguration(array $config, ContainerBuilder $co
576577
foreach ($config['packages'] as $name => $package) {
577578
if (null !== $package['version_strategy']) {
578579
$version = new Reference($package['version_strategy']);
579-
} elseif (null === $package['version']) {
580+
} elseif (!array_key_exists('version', $package)) {
580581
$version = $defaultVersion;
581582
} else {
582583
$format = $package['version_format'] ?: $config['version_format'];
@@ -775,7 +776,7 @@ private function registerValidationConfiguration(array $config, ContainerBuilder
775776
if (isset($config['cache'])) {
776777
$container->setParameter(
777778
'validator.mapping.cache.prefix',
778-
'validator_'.hash('sha256', $container->getParameter('kernel.root_dir'))
779+
'validator_'.$this->getKernelRootHash($container)
779780
);
780781

781782
$validatorBuilder->addMethodCall('setMetadataCache', array(new Reference($config['cache'])));
@@ -951,7 +952,7 @@ private function registerSerializerConfiguration(array $config, ContainerBuilder
951952
if (isset($config['cache']) && $config['cache']) {
952953
$container->setParameter(
953954
'serializer.mapping.cache.prefix',
954-
'serializer_'.hash('sha256', $container->getParameter('kernel.root_dir'))
955+
'serializer_'.$this->getKernelRootHash($container)
955956
);
956957

957958
$container->getDefinition('serializer.mapping.class_metadata_factory')->replaceArgument(
@@ -986,6 +987,22 @@ private function registerPropertyInfoConfiguration(array $config, ContainerBuild
986987
}
987988
}
988989

990+
/**
991+
* Gets a hash of the kernel root directory.
992+
*
993+
* @param ContainerBuilder $container
994+
*
995+
* @return string
996+
*/
997+
private function getKernelRootHash(ContainerBuilder $container)
998+
{
999+
if (!$this->kernelRootHash) {
1000+
$this->kernelRootHash = hash('sha256', $container->getParameter('kernel.root_dir'));
1001+
}
1002+
1003+
return $this->kernelRootHash;
1004+
}
1005+
9891006
/**
9901007
* Returns the base path for the XSD files.
9911008
*
File renamed without changes.

Resources/public/css/body.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ build: 56
117117
background: transparent url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAAcCAYAAACtQ6WLAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAR1JREFUeNpiPHnyZCMDA8MNID5gZmb2nAEJMH7//v3N169fX969e/cYkL8WqGAHXPLv37//QYzfv39/fvPmzbUnT56sAXInmJub/2H5/x8sx8DCwsIrISFhDmQyPX78+CmQXs70798/BmQsKipqBNTgdvz4cWkmkE5kDATMioqKZkCFdiwg1eiAi4tLGqhQF24nMmBmZuYEigth1QkEbEBxTlySYPvJkwSJ00AnjYylgU6gxB8g/oFVEphkvgLF32KNMmCCewYUv4qhEyj47+HDhyeBzIMYOoEp8CxQw56wsLAncJ1//vz5/P79+2svX74EJc2V4BT58+fPd8CE/QKYHMGJOiIiAp6oWW7evDkNSF8DZYfIyEiU7AAQYACJ2vxVdJW4eQAAAABJRU5ErkJggg==) right top no-repeat;
118118
}
119119
.sf-button .btn-bg {
120-
padding: 0px 14px;
120+
padding: 0 14px;
121121
color: #636363;
122122
line-height: 28px;
123123
background: transparent url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAcCAYAAACgXdXMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAClJREFUeNpiPnny5EKGf//+/Wf6//8/A4QAcrGzKCZwGc9sa2urBBBgAIbDUoYVp9lmAAAAAElFTkSuQmCC) repeat-x top left;

Resources/public/css/exception.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
padding: 5px 4px;
88
list-style-type: decimal;
99
margin-left: 20px;
10-
white-space: break-word;
1110
}
1211
.sf-reset #logs .traces li.error {
1312
font-style: normal;

Resources/views/Form/choice_widget_collapsed.html.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
)) ?>
88
<?php if ($multiple): ?> multiple="multiple"<?php endif ?>
99
>
10-
<?php if (null !== $placeholder): ?><option value=""<?php if ($required and empty($value) && '0' !== $value): ?> selected="selected"<?php endif?>><?php echo '' != $placeholder ? $view->escape(false !== $translation_domain ? $view['translator']->trans($placeholder, array(), $translation_domain) : $placeholder) : '' ?></option><?php endif; ?>
10+
<?php if (null !== $placeholder): ?><option value=""<?php if ($required && empty($value) && '0' !== $value): ?> selected="selected"<?php endif?>><?php echo '' != $placeholder ? $view->escape(false !== $translation_domain ? $view['translator']->trans($placeholder, array(), $translation_domain) : $placeholder) : '' ?></option><?php endif; ?>
1111
<?php if (count($preferred_choices) > 0): ?>
1212
<?php echo $view['form']->block($form, 'choice_widget_options', array('choices' => $preferred_choices)) ?>
1313
<?php if (count($choices) > 0 && null !== $separator): ?>

Templating/TemplateNameParser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function parse($name)
5555
throw new \RuntimeException(sprintf('Template name "%s" contains invalid characters.', $name));
5656
}
5757

58-
if (!preg_match('/^([^:]*):([^:]*):(.+)\.([^\.]+)\.([^\.]+)$/', $name, $matches)) {
58+
if (!preg_match('/^(?:([^:]*):)?(?:([^:]*):)?(.+)\.([^\.]+)\.([^\.]+)$/', $name, $matches)) {
5959
return parent::parse($name);
6060
}
6161

0 commit comments

Comments
 (0)