Skip to content

Commit 088b13c

Browse files
bug #57589 [FrameworkBundle] fix AssetMapper usage without assets enabled (xabbuh)
This PR was merged into the 6.4 branch. Discussion ---------- [FrameworkBundle] fix AssetMapper usage without assets enabled | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | Fix #57583 | License | MIT Commits ------- d9b669b fix AssetMapper usage without assets enabled
2 parents 995c3c7 + d9b669b commit 088b13c

File tree

5 files changed

+46
-0
lines changed

5 files changed

+46
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1334,6 +1334,10 @@ private function registerAssetMapperConfiguration(array $config, ContainerBuilde
13341334
{
13351335
$loader->load('asset_mapper.php');
13361336

1337+
if (!$assetEnabled) {
1338+
$container->removeDefinition('asset_mapper.asset_package');
1339+
}
1340+
13371341
if (!$httpClientEnabled) {
13381342
$container->register('asset_mapper.http_client', HttpClientInterface::class)
13391343
->addTag('container.error')
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
$container->loadFromExtension('framework', [
4+
'annotations' => false,
5+
'asset_mapper' => null,
6+
'assets' => false,
7+
'handle_all_throwables' => true,
8+
'http_method_override' => false,
9+
'php_errors' => ['log' => true],
10+
]);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" ?>
2+
<container xmlns="http://symfony.com/schema/dic/services"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xmlns:framework="http://symfony.com/schema/dic/symfony"
5+
xsi:schemaLocation="http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd
6+
http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
7+
8+
<framework:config http-method-override="false" handle-all-throwables="true">
9+
<framework:annotations enabled="false" />
10+
<framework:asset-mapper enabled="true" />
11+
<framework:assets enabled="false" />
12+
<framework:php-errors log="true" />
13+
</framework:config>
14+
</container>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
framework:
2+
annotations: false
3+
asset_mapper: ~
4+
assets: false
5+
handle_all_throwables: true
6+
http_method_override: false
7+
php_errors:
8+
log: true

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2386,6 +2386,16 @@ public function testWebhookWithoutSerializer()
23862386
);
23872387
}
23882388

2389+
public function testAssetMapperWithoutAssets()
2390+
{
2391+
$container = $this->createContainerFromFile('asset_mapper_without_assets');
2392+
2393+
$this->assertTrue($container->has('asset_mapper'));
2394+
$this->assertFalse($container->has('asset_mapper.asset_package'));
2395+
$this->assertFalse($container->has('assets.packages'));
2396+
$this->assertFalse($container->has('assets._default_package'));
2397+
}
2398+
23892399
protected function createContainer(array $data = [])
23902400
{
23912401
return new ContainerBuilder(new EnvPlaceholderParameterBag(array_merge([

0 commit comments

Comments
 (0)
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