Skip to content

[FrameworkBundle] fix AssetMapper usage without assets enabled #57589

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1334,6 +1334,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')
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

$container->loadFromExtension('framework', [
'annotations' => false,
'asset_mapper' => null,
'assets' => false,
'handle_all_throwables' => true,
'http_method_override' => false,
'php_errors' => ['log' => true],
]);
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:framework="http://symfony.com/schema/dic/symfony"
xsi:schemaLocation="http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd
http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">

<framework:config http-method-override="false" handle-all-throwables="true">
<framework:annotations enabled="false" />
<framework:asset-mapper enabled="true" />
<framework:assets enabled="false" />
<framework:php-errors log="true" />
</framework:config>
</container>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
framework:
annotations: false
asset_mapper: ~
assets: false
handle_all_throwables: true
http_method_override: false
php_errors:
log: true
Original file line number Diff line number Diff line change
Expand Up @@ -2386,6 +2386,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([
Expand Down
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