diff --git a/src/Symfony/Bridge/Doctrine/Test/DoctrineTestHelper.php b/src/Symfony/Bridge/Doctrine/Test/DoctrineTestHelper.php index 2ad16dcd4d..d3d25c17b2 100644 --- a/src/Symfony/Bridge/Doctrine/Test/DoctrineTestHelper.php +++ b/src/Symfony/Bridge/Doctrine/Test/DoctrineTestHelper.php @@ -12,7 +12,6 @@ namespace Symfony\Bridge\Doctrine\Test; use Doctrine\Common\Annotations\AnnotationReader; -use Doctrine\Common\Cache\ArrayCache; use Doctrine\ORM\Configuration; use Doctrine\ORM\EntityManager; use Doctrine\ORM\Mapping\Driver\AnnotationDriver; @@ -62,8 +61,6 @@ class DoctrineTestHelper $config->setProxyDir(sys_get_temp_dir()); $config->setProxyNamespace('SymfonyTests\Doctrine'); $config->setMetadataDriverImpl(new AnnotationDriver(new AnnotationReader())); - $config->setQueryCacheImpl(new ArrayCache()); - $config->setMetadataCacheImpl(new ArrayCache()); return $config; } diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index 53927c4a82..ac69dfd525 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -1443,8 +1443,8 @@ class FrameworkExtension extends Extension } $container - ->getDefinition('annotations.filesystem_cache') - ->replaceArgument(0, $cacheDir) + ->getDefinition('annotations.filesystem_cache_adapter') + ->replaceArgument(2, $cacheDir) ; $cacheService = 'annotations.filesystem_cache'; diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/annotations.php b/src/Symfony/Bundle/FrameworkBundle/Resources/config/annotations.php index 6a230c8340..187d9da664 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/annotations.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/annotations.php @@ -15,9 +15,9 @@ use Doctrine\Common\Annotations\AnnotationReader; use Doctrine\Common\Annotations\AnnotationRegistry; use Doctrine\Common\Annotations\CachedReader; use Doctrine\Common\Annotations\Reader; -use Doctrine\Common\Cache\ArrayCache; -use Doctrine\Common\Cache\FilesystemCache; use Symfony\Bundle\FrameworkBundle\CacheWarmer\AnnotationsCacheWarmer; +use Symfony\Component\Cache\Adapter\ArrayAdapter; +use Symfony\Component\Cache\Adapter\FilesystemAdapter; use Symfony\Component\Cache\Adapter\PhpArrayAdapter; use Symfony\Component\Cache\DoctrineProvider; @@ -35,15 +35,24 @@ return static function (ContainerConfigurator $container) { ->set('annotations.cached_reader', CachedReader::class) ->args([ service('annotations.reader'), - inline_service(ArrayCache::class), + inline_service(DoctrineProvider::class)->args([ + inline_service(ArrayAdapter::class) + ]), abstract_arg('Debug-Flag'), ]) - ->set('annotations.filesystem_cache', FilesystemCache::class) + ->set('annotations.filesystem_cache_adapter', FilesystemAdapter::class) ->args([ + '', + 0, abstract_arg('Cache-Directory'), ]) + ->set('annotations.filesystem_cache', DoctrineProvider::class) + ->args([ + service('annotations.filesystem_cache_adapter'), + ]) + ->set('annotations.cache_warmer', AnnotationsCacheWarmer::class) ->args([ service('annotations.reader'), diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php index f816acee64..960eda35d0 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php @@ -928,7 +928,7 @@ abstract class FrameworkExtensionTest extends TestCase $container->addCompilerPass(new TestAnnotationsPass()); $container->compile(); - $this->assertEquals($container->getParameter('kernel.cache_dir').'/annotations', $container->getDefinition('annotations.filesystem_cache')->getArgument(0)); + $this->assertEquals($container->getParameter('kernel.cache_dir').'/annotations', $container->getDefinition('annotations.filesystem_cache_adapter')->getArgument(2)); $this->assertSame('annotations.filesystem_cache', (string) $container->getDefinition('annotation_reader')->getArgument(1)); } diff --git a/src/Symfony/Component/Intl/Locale.php b/src/Symfony/Component/Intl/Locale.php index 8cc457b27b..94ac8da631 100644 --- a/src/Symfony/Component/Intl/Locale.php +++ b/src/Symfony/Component/Intl/Locale.php @@ -66,7 +66,8 @@ final class Locale extends \Locale public static function getFallback(string $locale): ?string { if (\function_exists('locale_parse')) { - $localeSubTags = locale_parse($locale); + $localeSubTags = locale_parse($locale) ?? ['language' => $locale]; + if (1 === \count($localeSubTags)) { if ('root' !== self::$defaultFallback && self::$defaultFallback === $localeSubTags['language']) { return 'root'; diff --git a/src/Symfony/Component/Intl/Tests/LocaleTest.php b/src/Symfony/Component/Intl/Tests/LocaleTest.php index fd998612a7..fce214242a 100644 --- a/src/Symfony/Component/Intl/Tests/LocaleTest.php +++ b/src/Symfony/Component/Intl/Tests/LocaleTest.php @@ -70,4 +70,16 @@ class LocaleTest extends TestCase Locale::setDefaultFallback($prev); } + + /** + * @requires function locale_parse + */ + public function testLongLocaleFallback() + { + $locale = 'LC_TYPE=fr_FR.UTF-8;LC_NUMERIC=C;LC_TIME=fr_FR.UTF-8;LC_COLLATE=fr_FR.UTF-8;'. + 'LC_MONETARY=fr_FR.UTF-8;LC_MESSAGES=fr_FR.UTF-8;LC_PAPER=fr_FR.UTF-8;LC_NAME=fr_FR.UTF-8;'. + 'LC_ADDRESS=fr_FR.UTF-8;LC_TELEPHONE=fr_FR.UTF-8;LC_MEASUREMENT=fr_FR.UTF-8;LC_IDENTIFICATION=fr_FR.UTF-8'; + + $this->assertNull(Locale::getFallback($locale)); + } } diff --git a/src/Symfony/Component/Validator/ValidatorBuilder.php b/src/Symfony/Component/Validator/ValidatorBuilder.php index 59698f327c..336c4f7be2 100644 --- a/src/Symfony/Component/Validator/ValidatorBuilder.php +++ b/src/Symfony/Component/Validator/ValidatorBuilder.php @@ -16,6 +16,8 @@ use Doctrine\Common\Annotations\CachedReader; use Doctrine\Common\Annotations\Reader; use Doctrine\Common\Cache\ArrayCache; use Psr\Cache\CacheItemPoolInterface; +use Symfony\Component\Cache\Adapter\ArrayAdapter; +use Symfony\Component\Cache\DoctrineProvider; use Symfony\Component\Validator\Context\ExecutionContextFactory; use Symfony\Component\Validator\Exception\ValidatorException; use Symfony\Component\Validator\Mapping\Factory\LazyLoadingMetadataFactory; @@ -266,7 +268,11 @@ class ValidatorBuilder */ public function addDefaultDoctrineAnnotationReader(): self { - $this->annotationReader = new CachedReader(new AnnotationReader(), new ArrayCache()); + if (class_exists(ArrayAdapter::class)) { + $this->annotationReader = new CachedReader(new AnnotationReader(), new DoctrineProvider(new ArrayAdapter())); + } else { + $this->annotationReader = new CachedReader(new AnnotationReader(), new ArrayCache()); + } return $this; }