diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php index 655e95cf93061..dbe6f8966eaf9 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php @@ -99,7 +99,7 @@ public function getConfigTreeBuilder() foreach ($v['templating']['packages'] as $name => $config) { $v['assets']['packages'][$name] = array( - 'version' => (string) $config['version'], + 'version' => null === $config['version'] ? null : (string) $config['version'], 'version_format' => $config['version_format'], 'base_path' => '', 'base_urls' => array_values(array_unique(array_merge($config['base_urls']['http'], $config['base_urls']['ssl']))), @@ -488,7 +488,13 @@ private function addTemplatingSection(ArrayNodeDefinition $rootNode) ->prototype('array') ->fixXmlConfig('base_url') ->children() - ->scalarNode('version')->defaultNull()->end() + ->scalarNode('version') + ->defaultNull() + ->beforeNormalization() + ->ifTrue(function ($v) { return '' === $v; }) + ->then(function ($v) { return; }) + ->end() + ->end() ->scalarNode('version_format')->defaultValue('%%s?%%s')->end() ->arrayNode('base_urls') ->performNoDeepMerging() @@ -547,7 +553,12 @@ private function addAssetsSection(ArrayNodeDefinition $rootNode) ->prototype('array') ->fixXmlConfig('base_url') ->children() - ->scalarNode('version')->defaultNull()->end() + ->scalarNode('version') + ->beforeNormalization() + ->ifTrue(function ($v) { return '' === $v; }) + ->then(function ($v) { return; }) + ->end() + ->end() ->scalarNode('version_format')->defaultNull()->end() ->scalarNode('base_path')->defaultValue('')->end() ->arrayNode('base_urls') diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index a7d8aab22079c..1e318903f6d96 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -584,7 +584,7 @@ private function registerAssetsConfiguration(array $config, ContainerBuilder $co $namedPackages = array(); foreach ($config['packages'] as $name => $package) { - if (null === $package['version']) { + if (!array_key_exists('version', $package)) { $version = $defaultVersion; } else { $format = $package['version_format'] ?: $config['version_format']; diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/assets.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/assets.php index e3532a7747cc6..1055251004bd9 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/assets.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/assets.php @@ -20,6 +20,10 @@ 'bar' => array( 'base_urls' => array('https://bar2.example.com'), ), + 'bar_null_version' => array( + 'version' => null, + 'base_urls' => array('https://bar3.example.com'), + ), ), ), )); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/legacy_templating_assets.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/legacy_templating_assets.php index 32bd56b3587d5..15df1015be15d 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/legacy_templating_assets.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/legacy_templating_assets.php @@ -18,6 +18,10 @@ 'bar' => array( 'base_urls' => array('https://bar2.example.com'), ), + 'bar_null_version' => array( + 'version' => null, + 'base_urls' => array('https://bar3.example.com'), + ), ), ), )); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/assets.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/assets.xml index e39e15f900528..3e057d5b90254 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/assets.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/assets.xml @@ -18,6 +18,9 @@ https://bar2.example.com + + https://bar3.example.com + diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/legacy_templating_assets.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/legacy_templating_assets.xml index 963848f767763..3b21e2cb4ed49 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/legacy_templating_assets.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/legacy_templating_assets.xml @@ -18,6 +18,9 @@ https://bar2.example.com + + https://bar3.example.com + diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/assets.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/assets.yml index 193dc59dfba3a..d3285ff58102c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/assets.yml +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/assets.yml @@ -14,3 +14,6 @@ framework: version_format: %%s-%%s bar: base_urls: ["https://bar2.example.com"] + bar_null_version: + version: null + base_urls: "https://bar3.example.com" diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/legacy_templating_assets.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/legacy_templating_assets.yml index e8cc6ce41d31c..f2c8ecfec6701 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/legacy_templating_assets.yml +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/legacy_templating_assets.yml @@ -13,3 +13,6 @@ framework: version_format: %%s-%%s bar: base_urls: "https://bar2.example.com" + bar_null_version: + version: null + base_urls: "https://bar3.example.com" diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php index 918c676afe1a1..67e6fd5b44058 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php @@ -516,7 +516,7 @@ private function checkAssetsPackages(ContainerBuilder $container, $legacy = fals // packages $packages = $packages->getArgument(1); - $this->assertCount($legacy ? 3 : 4, $packages); + $this->assertCount($legacy ? 4 : 5, $packages); if (!$legacy) { $package = $container->getDefinition($packages['images_path']); @@ -530,7 +530,10 @@ private function checkAssetsPackages(ContainerBuilder $container, $legacy = fals $this->assertPathPackage($container, $package, '', '1.0.0', '%%s-%%s'); $package = $container->getDefinition($packages['bar']); - $this->assertUrlPackage($container, $package, array('https://bar2.example.com'), $legacy ? '' : 'SomeVersionScheme', $legacy ? '%%s?%%s' : '%%s?version=%%s'); + $this->assertUrlPackage($container, $package, array('https://bar2.example.com'), $legacy ? null : 'SomeVersionScheme', $legacy ? '%%s?%%s' : '%%s?version=%%s'); + + $this->assertEquals($legacy ? 'assets.empty_version_strategy' : 'assets._version__default', (string) $container->getDefinition('assets._package_bar')->getArgument(1)); + $this->assertEquals('assets.empty_version_strategy', (string) $container->getDefinition('assets._package_bar_null_version')->getArgument(1)); } private function assertPathPackage(ContainerBuilder $container, Definition $package, $basePath, $version, $format) 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