diff --git a/Command/SecretsDecryptToLocalCommand.php b/Command/SecretsDecryptToLocalCommand.php
index f76e1d05a..cd8b26cf9 100644
--- a/Command/SecretsDecryptToLocalCommand.php
+++ b/Command/SecretsDecryptToLocalCommand.php
@@ -44,7 +44,7 @@ protected function configure(): void
%command.full_name%
-When the option --force is provided, secrets that already exist in the local vault are overriden.
+When the --force option is provided, secrets that already exist in the local vault are overridden.
%command.full_name% --force
EOF
diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php
index 92c20d139..1094c14d3 100644
--- a/DependencyInjection/Configuration.php
+++ b/DependencyInjection/Configuration.php
@@ -1118,7 +1118,8 @@ private function addSerializerSection(ArrayNodeDefinition $rootNode, callable $e
->end()
->arrayNode('default_context')
->normalizeKeys(false)
- ->beforeNormalization()
+ ->useAttributeAsKey('name')
+ ->validate()
->ifTrue(fn () => $this->debug && class_exists(JsonParser::class))
->then(fn (array $v) => $v + [JsonDecode::DETAILED_ERROR_MESSAGES => true])
->end()
diff --git a/DependencyInjection/FrameworkExtension.php b/DependencyInjection/FrameworkExtension.php
index fd57cc95e..1114246cc 100644
--- a/DependencyInjection/FrameworkExtension.php
+++ b/DependencyInjection/FrameworkExtension.php
@@ -1295,6 +1295,10 @@ private function registerAssetMapperConfiguration(array $config, ContainerBuilde
{
$loader->load('asset_mapper.php');
+ if (!$assetEnabled) {
+ $container->removeDefinition('asset_mapper.asset_package');
+ }
+
if (!$httpClientEnabled) {
$container->register('asset_mapper.http_client', HttpClientInterface::class)
->addTag('container.error')
diff --git a/Tests/CacheWarmer/ConfigBuilderCacheWarmerTest.php b/Tests/CacheWarmer/ConfigBuilderCacheWarmerTest.php
index 294a3cd25..66cf6b8d7 100644
--- a/Tests/CacheWarmer/ConfigBuilderCacheWarmerTest.php
+++ b/Tests/CacheWarmer/ConfigBuilderCacheWarmerTest.php
@@ -37,7 +37,7 @@ class ConfigBuilderCacheWarmerTest extends TestCase
protected function setUp(): void
{
- $this->varDir = sys_get_temp_dir().'/'.uniqid();
+ $this->varDir = sys_get_temp_dir().'/'.uniqid('', true);
$fs = new Filesystem();
$fs->mkdir($this->varDir);
}
diff --git a/Tests/DependencyInjection/ConfigurationTest.php b/Tests/DependencyInjection/ConfigurationTest.php
index b32d8681b..086d57aea 100644
--- a/Tests/DependencyInjection/ConfigurationTest.php
+++ b/Tests/DependencyInjection/ConfigurationTest.php
@@ -13,6 +13,7 @@
use Doctrine\DBAL\Connection;
use PHPUnit\Framework\TestCase;
+use Seld\JsonLint\JsonParser;
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Configuration;
use Symfony\Bundle\FullStack;
use Symfony\Component\Cache\Adapter\DoctrineAdapter;
@@ -567,6 +568,72 @@ public function testEnabledLockNeedsResources()
]);
}
+ public function testSerializerJsonDetailedErrorMessagesEnabledWhenDefaultContextIsConfigured()
+ {
+ $processor = new Processor();
+ $config = $processor->processConfiguration(new Configuration(true), [
+ [
+ 'http_method_override' => false,
+ 'handle_all_throwables' => true,
+ 'php_errors' => ['log' => true],
+ 'serializer' => [
+ 'default_context' => [
+ 'foo' => 'bar',
+ ],
+ ],
+ ],
+ ]);
+
+ $this->assertSame(['foo' => 'bar', JsonDecode::DETAILED_ERROR_MESSAGES => true], $config['serializer']['default_context'] ?? []);
+ }
+
+ public function testSerializerJsonDetailedErrorMessagesInDefaultContextCanBeDisabled()
+ {
+ $processor = new Processor();
+ $config = $processor->processConfiguration(new Configuration(true), [
+ [
+ 'http_method_override' => false,
+ 'handle_all_throwables' => true,
+ 'php_errors' => ['log' => true],
+ 'serializer' => [
+ 'default_context' => [
+ 'foo' => 'bar',
+ JsonDecode::DETAILED_ERROR_MESSAGES => false,
+ ],
+ ],
+ ],
+ ]);
+
+ $this->assertSame(['foo' => 'bar', JsonDecode::DETAILED_ERROR_MESSAGES => false], $config['serializer']['default_context'] ?? []);
+ }
+
+ public function testSerializerJsonDetailedErrorMessagesInDefaultContextCanBeDisabledWithSeveralConfigsBeingMerged()
+ {
+ $processor = new Processor();
+ $config = $processor->processConfiguration(new Configuration(true), [
+ [
+ 'http_method_override' => false,
+ 'handle_all_throwables' => true,
+ 'php_errors' => ['log' => true],
+ 'serializer' => [
+ 'default_context' => [
+ 'foo' => 'bar',
+ JsonDecode::DETAILED_ERROR_MESSAGES => false,
+ ],
+ ],
+ ],
+ [
+ 'serializer' => [
+ 'default_context' => [
+ 'foobar' => 'baz',
+ ],
+ ],
+ ],
+ ]);
+
+ $this->assertSame(['foo' => 'bar', JsonDecode::DETAILED_ERROR_MESSAGES => false, 'foobar' => 'baz'], $config['serializer']['default_context'] ?? []);
+ }
+
public function testScopedHttpClientsInheritRateLimiterAndRetryFailedConfiguration()
{
$processor = new Processor();
diff --git a/Tests/DependencyInjection/Fixtures/php/asset_mapper_without_assets.php b/Tests/DependencyInjection/Fixtures/php/asset_mapper_without_assets.php
new file mode 100644
index 000000000..8a74333b1
--- /dev/null
+++ b/Tests/DependencyInjection/Fixtures/php/asset_mapper_without_assets.php
@@ -0,0 +1,10 @@
+loadFromExtension('framework', [
+ 'annotations' => false,
+ 'asset_mapper' => null,
+ 'assets' => false,
+ 'handle_all_throwables' => true,
+ 'http_method_override' => false,
+ 'php_errors' => ['log' => true],
+]);
diff --git a/Tests/DependencyInjection/Fixtures/xml/asset_mapper_without_assets.xml b/Tests/DependencyInjection/Fixtures/xml/asset_mapper_without_assets.xml
new file mode 100644
index 000000000..3976b1064
--- /dev/null
+++ b/Tests/DependencyInjection/Fixtures/xml/asset_mapper_without_assets.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/Tests/DependencyInjection/Fixtures/yml/asset_mapper_without_assets.yml b/Tests/DependencyInjection/Fixtures/yml/asset_mapper_without_assets.yml
new file mode 100644
index 000000000..51f302b66
--- /dev/null
+++ b/Tests/DependencyInjection/Fixtures/yml/asset_mapper_without_assets.yml
@@ -0,0 +1,8 @@
+framework:
+ annotations: false
+ asset_mapper: ~
+ assets: false
+ handle_all_throwables: true
+ http_method_override: false
+ php_errors:
+ log: true
diff --git a/Tests/DependencyInjection/FrameworkExtensionTestCase.php b/Tests/DependencyInjection/FrameworkExtensionTestCase.php
index cb97f2a47..ef9fc0f20 100644
--- a/Tests/DependencyInjection/FrameworkExtensionTestCase.php
+++ b/Tests/DependencyInjection/FrameworkExtensionTestCase.php
@@ -2376,6 +2376,16 @@ public function testWebhookWithoutSerializer()
);
}
+ public function testAssetMapperWithoutAssets()
+ {
+ $container = $this->createContainerFromFile('asset_mapper_without_assets');
+
+ $this->assertTrue($container->has('asset_mapper'));
+ $this->assertFalse($container->has('asset_mapper.asset_package'));
+ $this->assertFalse($container->has('assets.packages'));
+ $this->assertFalse($container->has('assets._default_package'));
+ }
+
protected function createContainer(array $data = [])
{
return new ContainerBuilder(new EnvPlaceholderParameterBag(array_merge([
pFad - Phonifier reborn
Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies:
Alternative Proxy
pFad Proxy
pFad v3 Proxy
pFad v4 Proxy