Skip to content

Commit 1376b4b

Browse files
committed
Merge branch '3.3' into 3.4
* 3.3: (22 commits) [Routing] Fix resource miss [Security] Fixed auth provider authenticate() cannot return void declare argument type [FrameworkBundle][Serializer] Move normalizer/encoders definitions to xml file & remove unnecessary checks streamed response should return $this $isClientIpsVali is not used 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+ Fixed unsetting from loosely equal keys OrderedHashMap add DOMElement as return type in Crawler::getIterator to support foreach support in ide Fixed mistake in exception expectation [Debug] Fix same vendor detection in class loader ...
2 parents d5315f1 + 402246e commit 1376b4b

39 files changed

+248
-112
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: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,11 @@
6969
use Symfony\Component\Routing\Loader\AnnotationDirectoryLoader;
7070
use Symfony\Component\Routing\Loader\AnnotationFileLoader;
7171
use Symfony\Component\Security\Core\Security;
72-
use Symfony\Component\Serializer\Encoder\CsvEncoder;
7372
use Symfony\Component\Serializer\Encoder\DecoderInterface;
7473
use Symfony\Component\Serializer\Encoder\EncoderInterface;
75-
use Symfony\Component\Serializer\Encoder\YamlEncoder;
7674
use Symfony\Component\Serializer\Mapping\Factory\CacheClassMetadataFactory;
77-
use Symfony\Component\Serializer\Normalizer\DataUriNormalizer;
7875
use Symfony\Component\Serializer\Normalizer\DateIntervalNormalizer;
79-
use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer;
8076
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
81-
use Symfony\Component\Serializer\Normalizer\JsonSerializableNormalizer;
8277
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
8378
use Symfony\Component\Stopwatch\Stopwatch;
8479
use Symfony\Component\Translation\Command\XliffLintCommand as BaseXliffLintCommand;
@@ -1533,39 +1528,6 @@ private function registerSecurityCsrfConfiguration(array $config, ContainerBuild
15331528
*/
15341529
private function registerSerializerConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader)
15351530
{
1536-
if (class_exists('Symfony\Component\Serializer\Normalizer\DataUriNormalizer')) {
1537-
// Run before serializer.normalizer.object
1538-
$definition = $container->register('serializer.normalizer.data_uri', DataUriNormalizer::class);
1539-
$definition->setPublic(false);
1540-
$definition->addTag('serializer.normalizer', array('priority' => -920));
1541-
}
1542-
1543-
if (class_exists('Symfony\Component\Serializer\Normalizer\DateTimeNormalizer')) {
1544-
// Run before serializer.normalizer.object
1545-
$definition = $container->register('serializer.normalizer.datetime', DateTimeNormalizer::class);
1546-
$definition->setPublic(false);
1547-
$definition->addTag('serializer.normalizer', array('priority' => -910));
1548-
}
1549-
1550-
if (class_exists('Symfony\Component\Serializer\Normalizer\JsonSerializableNormalizer')) {
1551-
// Run before serializer.normalizer.object
1552-
$definition = $container->register('serializer.normalizer.json_serializable', JsonSerializableNormalizer::class);
1553-
$definition->setPublic(false);
1554-
$definition->addTag('serializer.normalizer', array('priority' => -900));
1555-
}
1556-
1557-
if (class_exists(YamlEncoder::class) && defined('Symfony\Component\Yaml\Yaml::DUMP_OBJECT')) {
1558-
$definition = $container->register('serializer.encoder.yaml', YamlEncoder::class);
1559-
$definition->setPublic(false);
1560-
$definition->addTag('serializer.encoder');
1561-
}
1562-
1563-
if (class_exists(CsvEncoder::class)) {
1564-
$definition = $container->register('serializer.encoder.csv', CsvEncoder::class);
1565-
$definition->setPublic(false);
1566-
$definition->addTag('serializer.encoder');
1567-
}
1568-
15691531
$loader->load('serializer.xml');
15701532

15711533
if (!class_exists(DateIntervalNormalizer::class)) {
@@ -1630,7 +1592,7 @@ private function registerSerializerConfiguration(array $config, ContainerBuilder
16301592
$container->getDefinition('serializer.mapping.class_metadata_factory')->replaceArgument(
16311593
1, new Reference($config['cache'])
16321594
);
1633-
} elseif (!$container->getParameter('kernel.debug') && class_exists(CacheClassMetadataFactory::class)) {
1595+
} elseif (!$container->getParameter('kernel.debug')) {
16341596
$cacheMetadataFactory = new Definition(
16351597
CacheClassMetadataFactory::class,
16361598
array(

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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,21 @@
3030
<tag name="serializer.normalizer" priority="-915" />
3131
</service>
3232

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+
3348
<service id="serializer.normalizer.object" class="Symfony\Component\Serializer\Normalizer\ObjectNormalizer">
3449
<argument type="service" id="serializer.mapping.class_metadata_factory" />
3550
<argument>null</argument> <!-- name converter -->
@@ -93,6 +108,14 @@
93108
<tag name="serializer.encoder" />
94109
</service>
95110

111+
<service id="serializer.encoder.yaml" class="Symfony\Component\Serializer\Encoder\YamlEncoder">
112+
<tag name="serializer.encoder" />
113+
</service>
114+
115+
<service id="serializer.encoder.csv" class="Symfony\Component\Serializer\Encoder\CsvEncoder">
116+
<tag name="serializer.encoder" />
117+
</service>
118+
96119
<!-- Name converter -->
97120
<service id="serializer.name_converter.camel_case_to_snake_case" class="Symfony\Component\Serializer\NameConverter\CamelCaseToSnakeCaseNameConverter" />
98121

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,12 +166,11 @@ public function testAssetsCanBeEnabled()
166166
*/
167167
public function testInvalidAssetsConfiguration(array $assetConfig, $expectedMessage)
168168
{
169-
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(
170-
InvalidConfigurationException::class,
171-
$expectedMessage
172-
);
173-
if (method_exists($this, 'expectExceptionMessage')) {
169+
if (method_exists($this, 'expectException')) {
170+
$this->expectException(InvalidConfigurationException::class);
174171
$this->expectExceptionMessage($expectedMessage);
172+
} else {
173+
$this->setExpectedException(InvalidConfigurationException::class, $expectedMessage);
175174
}
176175

177176
$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;
@@ -764,10 +763,6 @@ public function testRegisterSerializerExtractor()
764763

765764
public function testDataUriNormalizerRegistered()
766765
{
767-
if (!class_exists('Symfony\Component\Serializer\Normalizer\DataUriNormalizer')) {
768-
$this->markTestSkipped('The DataUriNormalizer has been introduced in the Serializer Component version 3.1.');
769-
}
770-
771766
$container = $this->createContainerFromFile('full');
772767

773768
$definition = $container->getDefinition('serializer.normalizer.data_uri');
@@ -794,10 +789,6 @@ public function testDateIntervalNormalizerRegistered()
794789

795790
public function testDateTimeNormalizerRegistered()
796791
{
797-
if (!class_exists('Symfony\Component\Serializer\Normalizer\DateTimeNormalizer')) {
798-
$this->markTestSkipped('The DateTimeNormalizer has been introduced in the Serializer Component version 3.1.');
799-
}
800-
801792
$container = $this->createContainerFromFile('full');
802793

803794
$definition = $container->getDefinition('serializer.normalizer.datetime');
@@ -809,10 +800,6 @@ public function testDateTimeNormalizerRegistered()
809800

810801
public function testJsonSerializableNormalizerRegistered()
811802
{
812-
if (!class_exists('Symfony\Component\Serializer\Normalizer\JsonSerializableNormalizer')) {
813-
$this->markTestSkipped('The JsonSerializableNormalizer has been introduced in the Serializer Component version 3.1.');
814-
}
815-
816803
$container = $this->createContainerFromFile('full');
817804

818805
$definition = $container->getDefinition('serializer.normalizer.json_serializable');
@@ -835,10 +822,6 @@ public function testObjectNormalizerRegistered()
835822

836823
public function testSerializerCacheActivated()
837824
{
838-
if (!class_exists(CacheClassMetadataFactory::class) || !method_exists(XmlFileLoader::class, 'getMappedClasses') || !method_exists(YamlFileLoader::class, 'getMappedClasses')) {
839-
$this->markTestSkipped('The Serializer default cache warmer has been introduced in the Serializer Component version 3.2.');
840-
}
841-
842825
$container = $this->createContainerFromFile('serializer_enabled');
843826

844827
$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
@@ -113,6 +113,7 @@ public function load(array $configs, ContainerBuilder $container)
113113
}
114114
}
115115

116+
// paths are modified in ExtensionPass if forms are enabled
116117
$container->getDefinition('twig.cache_warmer')->replaceArgument(2, $config['paths']);
117118
$container->getDefinition('twig.template_iterator')->replaceArgument(2, $config['paths']);
118119

src/Symfony/Component/Debug/DebugClassLoader.php

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -166,18 +166,11 @@ public function loadClass($class)
166166
}
167167

168168
// Don't trigger deprecations for classes in the same vendor
169-
if (2 > $len = 1 + (strpos($name, '\\', 1 + strpos($name, '\\')) ?: strpos($name, '_'))) {
169+
if (2 > $len = 1 + (strpos($name, '\\') ?: strpos($name, '_'))) {
170170
$len = 0;
171171
$ns = '';
172172
} else {
173-
switch ($ns = substr($name, 0, $len)) {
174-
case 'Symfony\Bridge\\':
175-
case 'Symfony\Bundle\\':
176-
case 'Symfony\Component\\':
177-
$ns = 'Symfony\\';
178-
$len = strlen($ns);
179-
break;
180-
}
173+
$ns = substr($name, 0, $len);
181174
}
182175

183176
// Detect annotations on the class

src/Symfony/Component/DomCrawler/Crawler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1071,7 +1071,7 @@ public function count()
10711071
}
10721072

10731073
/**
1074-
* @return \ArrayIterator
1074+
* @return \ArrayIterator|\DOMElement[]
10751075
*/
10761076
public function getIterator()
10771077
{

src/Symfony/Component/Form/Resources/translations/validators.sv.xlf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
<target>Den uppladdade filen var för stor. Försök ladda upp en mindre fil.</target>
1212
</trans-unit>
1313
<trans-unit id="30">
14-
<source>The CSRF token is invalid.</source>
15-
<target>CSRF-symbolen är inte giltig.</target>
14+
<source>The CSRF token is invalid. Please try to resubmit the form.</source>
15+
<target>CSRF-elementet är inte giltigt. Försök att skicka formuläret igen.</target>
1616
</trans-unit>
1717
</body>
1818
</file>

0 commit comments

Comments
 (0)