Skip to content

Commit f409eab

Browse files
committed
Revert "[1.3] Backport Symfony session listener for Symfony 3.4+ to restore user context functionality (#441)"
This reverts commit 5e9a1b2. Master already has this feature, avoid problems when we have to sync 1.3 to master in the future
1 parent 5e9a1b2 commit f409eab

File tree

9 files changed

+2
-249
lines changed

9 files changed

+2
-249
lines changed

.travis.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,6 @@ matrix:
5050
env:
5151
- SYMFONY_VERSION='3.2.*'
5252
- FRAMEWORK_EXTRA_VERSION='~3.0'
53-
- php: 5.6
54-
env:
55-
- SYMFONY_VERSION='3.4.*'
56-
- PHPUNIT_FLAGS="--group sf34"
57-
- FRAMEWORK_EXTRA_VERSION='~3.0'
5853
- php: hhvm
5954
dist: trusty
6055

CHANGELOG.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
Changelog
22
=========
33

4-
1.3.14
5-
------
6-
7-
* User context compatibility which was broken due to Symfony making responses
8-
private if the session is started as of Symfony 3.4+.
9-
104
1.3.13
115
------
126

DependencyInjection/FOSHttpCacheExtension.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
2020
use Symfony\Component\DependencyInjection\Reference;
2121
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
22-
use Symfony\Component\HttpKernel\Kernel;
2322
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
2423

2524
/**
@@ -225,15 +224,6 @@ private function loadUserContext(ContainerBuilder $container, XmlFileLoader $loa
225224
->addTag(HashGeneratorPass::TAG_NAME)
226225
->setAbstract(false);
227226
}
228-
229-
// Only decorate default session listener for Symfony 3.4+
230-
if (version_compare(Kernel::VERSION, '3.4', '>=')) {
231-
$container->getDefinition('fos_http_cache.user_context.session_listener')
232-
->setArgument(1, strtolower($config['user_hash_header']))
233-
->setArgument(2, array_map('strtolower', $config['user_identifier_headers']));
234-
} else {
235-
$container->removeDefinition('fos_http_cache.user_context.session_listener');
236-
}
237227
}
238228

239229
private function createRequestMatcher(ContainerBuilder $container, $path = null, $host = null, $methods = null, $ips = null, array $attributes = array())

EventListener/SessionListener.php

Lines changed: 0 additions & 85 deletions
This file was deleted.

Resources/config/user_context.xml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,6 @@
4141
<argument />
4242
</service>
4343

44-
<service id="fos_http_cache.user_context.session_listener" class="FOS\HttpCacheBundle\EventListener\SessionListener" decorates="session_listener" public="false">
45-
<argument type="service" id="fos_http_cache.user_context.session_listener.inner" />
46-
<argument /> <!-- set by extension -->
47-
<argument /> <!-- set by extension -->
48-
</service>
49-
5044
<service id="fos_http_cache.user_context.anonymous_request_matcher" class="FOS\HttpCache\UserContext\AnonymousRequestMatcher">
5145
<argument type="collection" />
5246
</service>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
fos_http_cache: []
1+
fos_http_cache:

Tests/Unit/DependencyInjection/FOSHttpCacheExtensionTest.php

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
use Symfony\Component\DependencyInjection\Definition;
1717
use Symfony\Component\DependencyInjection\DefinitionDecorator;
1818
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
19-
use Symfony\Component\HttpKernel\Kernel;
2019

2120
class FOSHttpCacheExtensionTest extends \PHPUnit_Framework_TestCase
2221
{
@@ -347,37 +346,6 @@ public function testConfigWithoutUserContext()
347346
$this->assertFalse($container->has('fos_http_cache.user_context.request_matcher'));
348347
$this->assertFalse($container->has('fos_http_cache.user_context.role_provider'));
349348
$this->assertFalse($container->has('fos_http_cache.user_context.logout_handler'));
350-
$this->assertFalse($container->has('fos_http_cache.user_context.session_listener'));
351-
}
352-
353-
/**
354-
* @group sf34
355-
*/
356-
public function testSessionListenerIsDecoratedIfNeeded()
357-
{
358-
$config = array(
359-
array('user_context' => array(
360-
'user_identifier_headers' => array('X-Foo'),
361-
'user_hash_header' => 'X-Bar',
362-
'hash_cache_ttl' => 30,
363-
'role_provider' => true,
364-
)),
365-
);
366-
367-
$container = $this->createContainer();
368-
$this->extension->load($config, $container);
369-
370-
// The whole definition should be removed for Symfony < 3.4
371-
if (version_compare(Kernel::VERSION, '3.4', '<')) {
372-
$this->assertFalse($container->hasDefinition('fos_http_cache.user_context.session_listener'));
373-
} else {
374-
$this->assertTrue($container->hasDefinition('fos_http_cache.user_context.session_listener'));
375-
376-
$definition = $container->getDefinition('fos_http_cache.user_context.session_listener');
377-
378-
$this->assertSame('x-bar', $definition->getArgument(1));
379-
$this->assertSame(array('x-foo'), $definition->getArgument(2));
380-
}
381349
}
382350

383351
public function testConfigLoadFlashMessageSubscriber()

Tests/Unit/EventListener/SessionListenerTest.php

Lines changed: 0 additions & 102 deletions
This file was deleted.

composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@
3434
"symfony/expression-language": "^2.4||^3.0",
3535
"symfony/monolog-bundle": "^2.3||^3.0",
3636
"polishsymfonycommunity/symfony-mocker-container": "^1.0",
37-
"matthiasnoback/symfony-dependency-injection-test": "^0.7.4",
38-
"sebastian/exporter": "^1.2||^2.0||^3.0"
37+
"matthiasnoback/symfony-dependency-injection-test": "^0.7.4"
3938
},
4039
"suggest": {
4140
"sensio/framework-extra-bundle": "For Tagged Cache Invalidation",

0 commit comments

Comments
 (0)