Skip to content

Commit cd2048b

Browse files
committed
Merge branch '2.8' into 3.0
* 2.8: Ability to set empty version strategy in packages Display Ajax request from newest to oldest in the toolbar CLI: use request context to generate absolute URLs [SecurityBundle] Optimize dependency injection tests Sort bundles in config commands [HttpFoundation] Do not overwrite the Authorization header if it is already set tag for dumped PHP objects must be a local one
2 parents f9076d7 + 412809f commit cd2048b

File tree

7 files changed

+25
-4
lines changed

7 files changed

+25
-4
lines changed

Command/AbstractConfigCommand.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,13 @@ protected function listBundles($output)
2929
{
3030
$headers = array('Bundle name', 'Extension alias');
3131
$rows = array();
32-
foreach ($this->getContainer()->get('kernel')->getBundles() as $bundle) {
32+
33+
$bundles = $this->getContainer()->get('kernel')->getBundles();
34+
usort($bundles, function($bundleA, $bundleB) {
35+
return strcmp($bundleA->getName(), $bundleB->getName());
36+
});
37+
38+
foreach ($bundles as $bundle) {
3339
$extension = $bundle->getContainerExtension();
3440
$rows[] = array($bundle->getName(), $extension ? $extension->getAlias() : '');
3541
}

DependencyInjection/Configuration.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,12 @@ private function addAssetsSection(ArrayNodeDefinition $rootNode)
383383
->prototype('array')
384384
->fixXmlConfig('base_url')
385385
->children()
386-
->scalarNode('version')->defaultNull()->end()
386+
->scalarNode('version')
387+
->beforeNormalization()
388+
->ifTrue(function ($v) { return '' === $v; })
389+
->then(function ($v) { return; })
390+
->end()
391+
->end()
387392
->scalarNode('version_format')->defaultNull()->end()
388393
->scalarNode('base_path')->defaultValue('')->end()
389394
->arrayNode('base_urls')

DependencyInjection/FrameworkExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ private function registerAssetsConfiguration(array $config, ContainerBuilder $co
568568

569569
$namedPackages = array();
570570
foreach ($config['packages'] as $name => $package) {
571-
if (null === $package['version']) {
571+
if (!array_key_exists('version', $package)) {
572572
$version = $defaultVersion;
573573
} else {
574574
$format = $package['version_format'] ?: $config['version_format'];

Tests/DependencyInjection/Fixtures/php/assets.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
'bar' => array(
2121
'base_urls' => array('https://bar2.example.com'),
2222
),
23+
'bar_null_version' => array(
24+
'version' => null,
25+
'base_urls' => array('https://bar3.example.com'),
26+
),
2327
),
2428
),
2529
));

Tests/DependencyInjection/Fixtures/xml/assets.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
<framework:package name="bar">
1919
<framework:base-url>https://bar2.example.com</framework:base-url>
2020
</framework:package>
21+
<framework:package name="bar_null_version" version="">
22+
<framework:base-url>https://bar3.example.com</framework:base-url>
23+
</framework:package>
2124
</framework:assets>
2225
</framework:config>
2326
</container>

Tests/DependencyInjection/Fixtures/yml/assets.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,6 @@ framework:
1414
version_format: %%s-%%s
1515
bar:
1616
base_urls: ["https://bar2.example.com"]
17+
bar_null_version:
18+
version: null
19+
base_urls: "https://bar3.example.com"

Tests/DependencyInjection/FrameworkExtensionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ public function testAssets()
209209

210210
// packages
211211
$packages = $packages->getArgument(1);
212-
$this->assertCount(4, $packages);
212+
$this->assertCount(5, $packages);
213213

214214
$package = $container->getDefinition($packages['images_path']);
215215
$this->assertPathPackage($container, $package, '/foo', 'SomeVersionScheme', '%%s?version=%%s');

0 commit comments

Comments
 (0)