Skip to content

Commit 2b725ca

Browse files
Merge branch '3.4'
* 3.4: (26 commits) [Routing] Fix resource miss [Security] Fixed auth provider authenticate() cannot return void [FrameworkBundle][Serializer] Move DateIntervalNormalizer definition to xml declare argument type Improving annotation loader message [FrameworkBundle][Serializer] Move normalizer/encoders definitions to xml file & remove unnecessary checks Update UPGRADE-4.0.md streamed response should return $this $isClientIpsVali is not used [WebServerBundle] Prevent commands from being registered by convention content can be a resource Adding the Form default theme files to be warmed up in Twig's cache Remove BC Break label from `NullDumper` class Username and password in basic auth are allowed to contain '.' Remove obsolete PHPDoc from UriSigner [Serializer] YamlEncoder: throw if the Yaml component isn't installed [Serializer] ObjectNormalizer: throw if PropertyAccess isn't installed [PropertyInfo] Add support for the iterable type pdo session fix Fixed pathinfo calculation for requests starting with a question mark. - fix bad conflict resolving issue - port symfony#21968 to 3.3+ ...
2 parents 4c414d8 + 1376b4b commit 2b725ca

File tree

49 files changed

+305
-129
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+305
-129
lines changed

UPGRADE-3.3.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ DependencyInjection
8484

8585
* Autowiring services based on the types they implement is deprecated and won't be supported in version 4.0. Rename (or alias) your services to their FQCN id to make them autowirable.
8686

87-
* [BC BREAK] The `NullDumper` class has been made final
87+
* The `NullDumper` class has been made final
8888

8989
* [BC BREAK] `_defaults` and `_instanceof` are now reserved service names in Yaml configurations. Please rename any services with that names.
9090

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 4 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,11 @@
6767
use Symfony\Component\Routing\Loader\AnnotationDirectoryLoader;
6868
use Symfony\Component\Routing\Loader\AnnotationFileLoader;
6969
use Symfony\Component\Security\Core\Security;
70-
use Symfony\Component\Serializer\Encoder\CsvEncoder;
7170
use Symfony\Component\Serializer\Encoder\DecoderInterface;
7271
use Symfony\Component\Serializer\Encoder\EncoderInterface;
73-
use Symfony\Component\Serializer\Encoder\YamlEncoder;
7472
use Symfony\Component\Serializer\Mapping\Factory\CacheClassMetadataFactory;
75-
use Symfony\Component\Serializer\Normalizer\DataUriNormalizer;
7673
use Symfony\Component\Serializer\Normalizer\DateIntervalNormalizer;
77-
use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer;
7874
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
79-
use Symfony\Component\Serializer\Normalizer\JsonSerializableNormalizer;
8075
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
8176
use Symfony\Component\Stopwatch\Stopwatch;
8277
use Symfony\Component\Translation\Command\XliffLintCommand as BaseXliffLintCommand;
@@ -1252,48 +1247,12 @@ private function registerSecurityCsrfConfiguration(array $config, ContainerBuild
12521247
*/
12531248
private function registerSerializerConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader)
12541249
{
1255-
if (class_exists('Symfony\Component\Serializer\Normalizer\DataUriNormalizer')) {
1256-
// Run before serializer.normalizer.object
1257-
$definition = $container->register('serializer.normalizer.data_uri', DataUriNormalizer::class);
1258-
$definition->setPublic(false);
1259-
$definition->addTag('serializer.normalizer', array('priority' => -920));
1260-
}
1261-
1262-
if (class_exists(DateIntervalNormalizer::class)) {
1263-
// Run before serializer.normalizer.object
1264-
$definition = $container->register('serializer.normalizer.dateinterval', DateIntervalNormalizer::class);
1265-
$definition->setPublic(false);
1266-
$definition->addTag('serializer.normalizer', array('priority' => -915));
1267-
}
1268-
1269-
if (class_exists('Symfony\Component\Serializer\Normalizer\DateTimeNormalizer')) {
1270-
// Run before serializer.normalizer.object
1271-
$definition = $container->register('serializer.normalizer.datetime', DateTimeNormalizer::class);
1272-
$definition->setPublic(false);
1273-
$definition->addTag('serializer.normalizer', array('priority' => -910));
1274-
}
1275-
1276-
if (class_exists('Symfony\Component\Serializer\Normalizer\JsonSerializableNormalizer')) {
1277-
// Run before serializer.normalizer.object
1278-
$definition = $container->register('serializer.normalizer.json_serializable', JsonSerializableNormalizer::class);
1279-
$definition->setPublic(false);
1280-
$definition->addTag('serializer.normalizer', array('priority' => -900));
1281-
}
1250+
$loader->load('serializer.xml');
12821251

1283-
if (class_exists(YamlEncoder::class) && defined('Symfony\Component\Yaml\Yaml::DUMP_OBJECT')) {
1284-
$definition = $container->register('serializer.encoder.yaml', YamlEncoder::class);
1285-
$definition->setPublic(false);
1286-
$definition->addTag('serializer.encoder');
1252+
if (!class_exists(DateIntervalNormalizer::class)) {
1253+
$container->removeDefinition('serializer.normalizer.dateinterval');
12871254
}
12881255

1289-
if (class_exists(CsvEncoder::class)) {
1290-
$definition = $container->register('serializer.encoder.csv', CsvEncoder::class);
1291-
$definition->setPublic(false);
1292-
$definition->addTag('serializer.encoder');
1293-
}
1294-
1295-
$loader->load('serializer.xml');
1296-
12971256
$chainLoader = $container->getDefinition('serializer.mapping.chain_loader');
12981257

12991258
$serializerLoaders = array();
@@ -1341,7 +1300,7 @@ private function registerSerializerConfiguration(array $config, ContainerBuilder
13411300
$chainLoader->replaceArgument(0, $serializerLoaders);
13421301
$container->getDefinition('serializer.mapping.cache_warmer')->replaceArgument(0, $serializerLoaders);
13431302

1344-
if (!$container->getParameter('kernel.debug') && class_exists(CacheClassMetadataFactory::class)) {
1303+
if (!$container->getParameter('kernel.debug')) {
13451304
$cacheMetadataFactory = new Definition(
13461305
CacheClassMetadataFactory::class,
13471306
array(

src/Symfony/Bundle/FrameworkBundle/Resources/config/serializer.xml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,26 @@
2525
<service id="serializer.property_accessor" alias="property_accessor" />
2626

2727
<!-- Normalizer -->
28+
<service id="serializer.normalizer.dateinterval" class="Symfony\Component\Serializer\Normalizer\DateIntervalNormalizer">
29+
<!-- Run before serializer.normalizer.object -->
30+
<tag name="serializer.normalizer" priority="-915" />
31+
</service>
32+
33+
<service id="serializer.normalizer.data_uri" class="Symfony\Component\Serializer\Normalizer\DataUriNormalizer">
34+
<!-- Run before serializer.normalizer.object -->
35+
<tag name="serializer.normalizer" priority="-920" />
36+
</service>
37+
38+
<service id="serializer.normalizer.datetime" class="Symfony\Component\Serializer\Normalizer\DateTimeNormalizer">
39+
<!-- Run before serializer.normalizer.object -->
40+
<tag name="serializer.normalizer" priority="-910" />
41+
</service>
42+
43+
<service id="serializer.normalizer.json_serializable" class="Symfony\Component\Serializer\Normalizer\JsonSerializableNormalizer">
44+
<!-- Run before serializer.normalizer.object -->
45+
<tag name="serializer.normalizer" priority="-900" />
46+
</service>
47+
2848
<service id="serializer.normalizer.object" class="Symfony\Component\Serializer\Normalizer\ObjectNormalizer">
2949
<argument type="service" id="serializer.mapping.class_metadata_factory" />
3050
<argument>null</argument> <!-- name converter -->
@@ -77,6 +97,14 @@
7797
<tag name="serializer.encoder" />
7898
</service>
7999

100+
<service id="serializer.encoder.yaml" class="Symfony\Component\Serializer\Encoder\YamlEncoder">
101+
<tag name="serializer.encoder" />
102+
</service>
103+
104+
<service id="serializer.encoder.csv" class="Symfony\Component\Serializer\Encoder\CsvEncoder">
105+
<tag name="serializer.encoder" />
106+
</service>
107+
80108
<!-- Name converter -->
81109
<service id="serializer.name_converter.camel_case_to_snake_case" class="Symfony\Component\Serializer\NameConverter\CamelCaseToSnakeCaseNameConverter" />
82110

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,11 @@ public function testAssetsCanBeEnabled()
6969
*/
7070
public function testInvalidAssetsConfiguration(array $assetConfig, $expectedMessage)
7171
{
72-
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(
73-
InvalidConfigurationException::class,
74-
$expectedMessage
75-
);
76-
if (method_exists($this, 'expectExceptionMessage')) {
72+
if (method_exists($this, 'expectException')) {
73+
$this->expectException(InvalidConfigurationException::class);
7774
$this->expectExceptionMessage($expectedMessage);
75+
} else {
76+
$this->setExpectedException(InvalidConfigurationException::class, $expectedMessage);
7877
}
7978

8079
$processor = new Processor();

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
use Symfony\Component\Serializer\Mapping\Loader\AnnotationLoader;
3737
use Symfony\Component\Serializer\Normalizer\DateIntervalNormalizer;
3838
use Symfony\Component\Serializer\Serializer;
39-
use Symfony\Component\Serializer\Mapping\Factory\CacheClassMetadataFactory;
4039
use Symfony\Component\Serializer\Mapping\Loader\XmlFileLoader;
4140
use Symfony\Component\Serializer\Mapping\Loader\YamlFileLoader;
4241
use Symfony\Component\Serializer\Normalizer\DataUriNormalizer;
@@ -757,10 +756,6 @@ public function testRegisterSerializerExtractor()
757756

758757
public function testDataUriNormalizerRegistered()
759758
{
760-
if (!class_exists('Symfony\Component\Serializer\Normalizer\DataUriNormalizer')) {
761-
$this->markTestSkipped('The DataUriNormalizer has been introduced in the Serializer Component version 3.1.');
762-
}
763-
764759
$container = $this->createContainerFromFile('full');
765760

766761
$definition = $container->getDefinition('serializer.normalizer.data_uri');
@@ -787,10 +782,6 @@ public function testDateIntervalNormalizerRegistered()
787782

788783
public function testDateTimeNormalizerRegistered()
789784
{
790-
if (!class_exists('Symfony\Component\Serializer\Normalizer\DateTimeNormalizer')) {
791-
$this->markTestSkipped('The DateTimeNormalizer has been introduced in the Serializer Component version 3.1.');
792-
}
793-
794785
$container = $this->createContainerFromFile('full');
795786

796787
$definition = $container->getDefinition('serializer.normalizer.datetime');
@@ -802,10 +793,6 @@ public function testDateTimeNormalizerRegistered()
802793

803794
public function testJsonSerializableNormalizerRegistered()
804795
{
805-
if (!class_exists('Symfony\Component\Serializer\Normalizer\JsonSerializableNormalizer')) {
806-
$this->markTestSkipped('The JsonSerializableNormalizer has been introduced in the Serializer Component version 3.1.');
807-
}
808-
809796
$container = $this->createContainerFromFile('full');
810797

811798
$definition = $container->getDefinition('serializer.normalizer.json_serializable');
@@ -828,10 +815,6 @@ public function testObjectNormalizerRegistered()
828815

829816
public function testSerializerCacheActivated()
830817
{
831-
if (!class_exists(CacheClassMetadataFactory::class) || !method_exists(XmlFileLoader::class, 'getMappedClasses') || !method_exists(YamlFileLoader::class, 'getMappedClasses')) {
832-
$this->markTestSkipped('The Serializer default cache warmer has been introduced in the Serializer Component version 3.2.');
833-
}
834-
835818
$container = $this->createContainerFromFile('serializer_enabled');
836819

837820
$this->assertTrue($container->hasDefinition('serializer.mapping.cache_class_metadata_factory'));

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,14 @@ public function process(ContainerBuilder $container)
4343
if ($container->has('form.extension')) {
4444
$container->getDefinition('twig.extension.form')->addTag('twig.extension');
4545
$reflClass = new \ReflectionClass('Symfony\Bridge\Twig\Extension\FormExtension');
46-
$container->getDefinition('twig.loader.native_filesystem')->addMethodCall('addPath', array(dirname(dirname($reflClass->getFileName())).'/Resources/views/Form'));
46+
47+
$coreThemePath = dirname(dirname($reflClass->getFileName())).'/Resources/views/Form';
48+
$container->getDefinition('twig.loader.native_filesystem')->addMethodCall('addPath', array($coreThemePath));
49+
50+
$paths = $container->getDefinition('twig.cache_warmer')->getArgument(2);
51+
$paths[$coreThemePath] = null;
52+
$container->getDefinition('twig.cache_warmer')->replaceArgument(2, $paths);
53+
$container->getDefinition('twig.template_iterator')->replaceArgument(2, $paths);
4754
}
4855

4956
if ($container->has('router')) {

src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ public function load(array $configs, ContainerBuilder $container)
106106
}
107107
}
108108

109+
// paths are modified in ExtensionPass if forms are enabled
109110
$container->getDefinition('twig.cache_warmer')->replaceArgument(2, $config['paths']);
110111
$container->getDefinition('twig.template_iterator')->replaceArgument(2, $config['paths']);
111112

src/Symfony/Bundle/WebServerBundle/Command/ServerLogCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ class ServerLogCommand extends Command
2929
private $el;
3030
private $handler;
3131

32+
protected static $defaultName = 'server:log';
33+
3234
public function isEnabled()
3335
{
3436
if (!class_exists(ConsoleFormatter::class)) {
@@ -40,8 +42,6 @@ public function isEnabled()
4042

4143
protected function configure()
4244
{
43-
$this->setName('server:log');
44-
4545
if (!class_exists(ConsoleFormatter::class)) {
4646
return;
4747
}

src/Symfony/Bundle/WebServerBundle/Command/ServerRunCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ class ServerRunCommand extends Command
3232
private $documentRoot;
3333
private $environment;
3434

35+
protected static $defaultName = 'server:run';
36+
3537
public function __construct($documentRoot = null, $environment = null)
3638
{
3739
$this->documentRoot = $documentRoot;
@@ -51,7 +53,6 @@ protected function configure()
5153
new InputOption('docroot', 'd', InputOption::VALUE_REQUIRED, 'Document root, usually where your front controllers are stored'),
5254
new InputOption('router', 'r', InputOption::VALUE_REQUIRED, 'Path to custom router script'),
5355
))
54-
->setName('server:run')
5556
->setDescription('Runs a local web server')
5657
->setHelp(<<<'EOF'
5758
<info>%command.name%</info> runs a local web server: By default, the server

src/Symfony/Bundle/WebServerBundle/Command/ServerStartCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ class ServerStartCommand extends Command
3131
private $documentRoot;
3232
private $environment;
3333

34+
protected static $defaultName = 'server:start';
35+
3436
public function __construct($documentRoot = null, $environment = null)
3537
{
3638
$this->documentRoot = $documentRoot;
@@ -45,7 +47,6 @@ public function __construct($documentRoot = null, $environment = null)
4547
protected function configure()
4648
{
4749
$this
48-
->setName('server:start')
4950
->setDefinition(array(
5051
new InputArgument('addressport', InputArgument::OPTIONAL, 'The address to listen to (can be address:port, address, or port)'),
5152
new InputOption('docroot', 'd', InputOption::VALUE_REQUIRED, 'Document root'),

0 commit comments

Comments
 (0)