Skip to content

Commit de418f4

Browse files
Merge branch '3.3' into 3.4
* 3.3: Don't display the Symfony debug toolbar when printing the page do not wire namespaces for the ArrayAdapter check _controller attribute is a string before parsing it [Cache] Added test for ApcuAdapter when using in CLI allow to configure custom formats in XML configs [HttpKernel] fix DumpDataCollector tests [FrameworkBundle] fix changelog [WebProfilerBundle] Cleanup profiler leftover [DotEnv] Fix variable substitution require the XML PHP extension Fix phpdoc for serializer normalizers exceptions Fixed absolute url generation for query strings and hash urls bumped Symfony version to 2.8.25 updated VERSION for 2.8.24 updated CHANGELOG for 2.8.24 bumped Symfony version to 2.7.32 [Filesystem] Dont copy perms when origin is remote updated VERSION for 2.7.31 update CONTRIBUTORS for 2.7.31 updated CHANGELOG for 2.7.31
2 parents d9db444 + 3951079 commit de418f4

File tree

5 files changed

+36
-6
lines changed

5 files changed

+36
-6
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ CHANGELOG
8989
* Deprecated using core form types without dependencies as services
9090
* Added `Symfony\Component\HttpHernel\DataCollector\RequestDataCollector::onKernelResponse()`
9191
* Added `Symfony\Bundle\FrameworkBundle\DataCollector\RequestDataCollector`
92-
* Deprecated service `serializer.mapping.cache.apc` (use `serializer.mapping.cache.doctrine.apc` instead)
92+
* The `framework.serializer.cache` option and the service `serializer.mapping.cache.apc` have been
93+
deprecated. APCu should now be automatically used when available.
9394

9495
3.0.0
9596
-----

DependencyInjection/Compiler/CachePoolPass.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler;
1313

1414
use Symfony\Component\Cache\Adapter\AbstractAdapter;
15+
use Symfony\Component\Cache\Adapter\ArrayAdapter;
1516
use Symfony\Component\DependencyInjection\ChildDefinition;
1617
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
1718
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -72,7 +73,7 @@ public function process(ContainerBuilder $container)
7273
}
7374
$i = 0;
7475
foreach ($attributes as $attr) {
75-
if (isset($tags[0][$attr])) {
76+
if (isset($tags[0][$attr]) && ('namespace' !== $attr || ArrayAdapter::class !== $adapter->getClass())) {
7677
$pool->replaceArgument($i++, $tags[0][$attr]);
7778
}
7879
unset($tags[0][$attr]);

EventListener/ResolveControllerNameSubscriber.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function __construct(ControllerNameParser $parser)
3333
public function onKernelRequest(GetResponseEvent $event)
3434
{
3535
$controller = $event->getRequest()->attributes->get('_controller');
36-
if ($controller && false === strpos($controller, '::') && 2 === substr_count($controller, ':')) {
36+
if (is_string($controller) && false === strpos($controller, '::') && 2 === substr_count($controller, ':')) {
3737
// controller in the a:b:c notation then
3838
$event->getRequest()->attributes->set('_controller', $this->parser->parse($controller));
3939
}

Tests/DependencyInjection/Compiler/CachePoolPassTest.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use PHPUnit\Framework\TestCase;
1515
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\CachePoolPass;
16+
use Symfony\Component\Cache\Adapter\ArrayAdapter;
1617
use Symfony\Component\DependencyInjection\ChildDefinition;
1718
use Symfony\Component\DependencyInjection\ContainerBuilder;
1819
use Symfony\Component\DependencyInjection\Definition;
@@ -49,6 +50,24 @@ public function testNamespaceArgumentIsReplaced()
4950
$this->assertSame('D07rhFx97S', $cachePool->getArgument(0));
5051
}
5152

53+
public function testNamespaceArgumentIsNotReplacedIfArrayAdapterIsUsed()
54+
{
55+
$container = new ContainerBuilder();
56+
$container->setParameter('kernel.environment', 'prod');
57+
$container->setParameter('kernel.name', 'app');
58+
$container->setParameter('kernel.root_dir', 'foo');
59+
60+
$container->register('cache.adapter.array', ArrayAdapter::class)->addArgument(0);
61+
62+
$cachePool = new ChildDefinition('cache.adapter.array');
63+
$cachePool->addTag('cache.pool');
64+
$container->setDefinition('app.cache_pool', $cachePool);
65+
66+
$this->cachePoolPass->process($container);
67+
68+
$this->assertCount(0, $container->getDefinition('app.cache_pool')->getArguments());
69+
}
70+
5271
public function testArgsAreReplaced()
5372
{
5473
$container = new ContainerBuilder();

Tests/EventListener/ResolveControllerNameSubscriberTest.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,27 @@ public function testReplacesControllerAttribute()
3737
$this->assertEquals('App\\Final\\Format::methodName', $request->attributes->get('_controller'));
3838
}
3939

40-
public function testSkipsOtherControllerFormats()
40+
/**
41+
* @dataProvider provideSkippedControllers
42+
*/
43+
public function testSkipsOtherControllerFormats($controller)
4144
{
4245
$parser = $this->getMockBuilder(ControllerNameParser::class)->disableOriginalConstructor()->getMock();
4346
$parser->expects($this->never())
4447
->method('parse');
4548
$httpKernel = $this->getMockBuilder(HttpKernelInterface::class)->getMock();
4649

4750
$request = new Request();
48-
$request->attributes->set('_controller', 'Other:format');
51+
$request->attributes->set('_controller', $controller);
4952

5053
$subscriber = new ResolveControllerNameSubscriber($parser);
5154
$subscriber->onKernelRequest(new GetResponseEvent($httpKernel, $request, HttpKernelInterface::MASTER_REQUEST));
52-
$this->assertEquals('Other:format', $request->attributes->get('_controller'));
55+
$this->assertEquals($controller, $request->attributes->get('_controller'));
56+
}
57+
58+
public function provideSkippedControllers()
59+
{
60+
yield array('Other:format');
61+
yield array(function () {});
5362
}
5463
}

0 commit comments

Comments
 (0)