diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml
index f250d39c..892ce9e6 100644
--- a/.github/workflows/php.yml
+++ b/.github/workflows/php.yml
@@ -21,12 +21,12 @@ jobs:
dependencies: 'jean-beru/fos-http-cache-cloudfront'
- php-version: '8.1'
symfony-version: '6.4'
+ - php-version: '8.2'
+ symfony-version: '6.4'
- php-version: '8.2'
symfony-version: '7.*'
- php-version: '8.3'
symfony-version: '7.*'
- - php-version: '8.2'
- symfony-version: '6.4'
# Minimum supported dependencies with the oldest PHP version
- php-version: '8.1'
composer-flag: '--prefer-stable --prefer-lowest'
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2848eba8..ca700180 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,9 @@ Changelog
Remove all configuration you have at `fos_http_cache.tags.annotations`
* Make `fastly` and `cloudflare` clients lazy loaded to support Symfony secrets that are only available at runtime, but
not yet when the container is built.
+* Removed deprecated `FOS\HttpCacheBundle\UserContext\AnonymousRequestMatcher`, use the
+ `FOS\HttpCache\UserContext\AnonymousRequestMatcher` class.
+* Removed deprecated `ContextInvalidationLogoutHandler`, use `ContextInvalidationSessionLogoutHandle` instead.
2.x
===
diff --git a/src/DependencyInjection/FOSHttpCacheExtension.php b/src/DependencyInjection/FOSHttpCacheExtension.php
index c2e281b3..fe4c46d1 100644
--- a/src/DependencyInjection/FOSHttpCacheExtension.php
+++ b/src/DependencyInjection/FOSHttpCacheExtension.php
@@ -28,7 +28,6 @@
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
-use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
final class FOSHttpCacheExtension extends Extension
@@ -281,12 +280,6 @@ private function loadUserContext(ContainerBuilder $container, XmlFileLoader $loa
}
$loader->load('user_context.xml');
- // TODO: Remove this service file when going to version 3 of the bundle
- if (Kernel::MAJOR_VERSION >= 6) {
- $loader->load('user_context_legacy_sf6.xml');
- } else {
- $loader->load('user_context_legacy.xml');
- }
$container->getDefinition('fos_http_cache.user_context.request_matcher')
->replaceArgument(0, $config['match']['accept'])
diff --git a/src/Resources/config/user_context_legacy.xml b/src/Resources/config/user_context_legacy.xml
deleted file mode 100644
index ae060183..00000000
--- a/src/Resources/config/user_context_legacy.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
- The "%service_id%" service is deprecated since 2.2 and will be removed in 3.0.
-
-
-
diff --git a/src/Resources/config/user_context_legacy_sf6.xml b/src/Resources/config/user_context_legacy_sf6.xml
deleted file mode 100644
index cf23e18f..00000000
--- a/src/Resources/config/user_context_legacy_sf6.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
- The "%service_id%" service is deprecated since 2.2 and will be removed in 3.0.
-
-
-
diff --git a/src/Security/Http/Logout/ContextInvalidationLogoutHandler.php b/src/Security/Http/Logout/ContextInvalidationLogoutHandler.php
deleted file mode 100644
index 5e99c014..00000000
--- a/src/Security/Http/Logout/ContextInvalidationLogoutHandler.php
+++ /dev/null
@@ -1,51 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace FOS\HttpCacheBundle\Security\Http\Logout;
-
-use FOS\HttpCacheBundle\UserContextInvalidator;
-use Symfony\Component\HttpFoundation\Request;
-use Symfony\Component\HttpFoundation\Response;
-use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
-use Symfony\Component\Security\Http\Event\LogoutEvent;
-use Symfony\Component\Security\Http\Logout\LogoutHandlerInterface;
-
-/**
- * @deprecated use ContextInvalidationSessionLogoutHandler in this same namespace as a replacement
- *
- * This handler is deprecated because it never did what it was supposed to do. The session is already invalidated by the SessionLogoutHandler
- * which is always the first logout handler executed
- */
-final class ContextInvalidationLogoutHandler implements LogoutHandlerInterface
-{
- private $invalidator;
-
- public function __construct(UserContextInvalidator $invalidator)
- {
- $this->invalidator = $invalidator;
- }
-
- /**
- * {@inheritdoc}
- */
- public function logout(Request $request, Response $response, TokenInterface $token)
- {
- @trigger_error('Using the ContextInvalidationLogoutHandler is deprecated', E_USER_DEPRECATED);
-
- if (class_exists(LogoutEvent::class)) {
- // This class no longer works at all with Symfony 5.1, force usage of ContextInvalidationSessionLogoutHandler instead
- // See also: https://github.com/FriendsOfSymfony/FOSHttpCacheBundle/pull/545#discussion_r465089219
- throw new \LogicException(__CLASS__.'::'.__METHOD__.' no longer works with Symfony 5.1. Remove fos_http_cache.user_context.logout_handler from your firewall configuration. See the changelog for version 2.2. for more information.');
- }
-
- $this->invalidator->invalidateContext($request->getSession()->getId());
- }
-}
diff --git a/src/UserContext/AnonymousRequestMatcher.php b/src/UserContext/AnonymousRequestMatcher.php
deleted file mode 100644
index 2241c99b..00000000
--- a/src/UserContext/AnonymousRequestMatcher.php
+++ /dev/null
@@ -1,40 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace FOS\HttpCacheBundle\UserContext;
-
-use FOS\HttpCache\UserContext\AnonymousRequestMatcher as BaseAnonymousRequestMatcher;
-
-/**
- * Matches anonymous requests using a list of identification headers.
- *
- * @deprecated Use AnonymousRequestMatcher of HttpCache library
- */
-class AnonymousRequestMatcher extends BaseAnonymousRequestMatcher
-{
- public function __construct(array $options = [])
- {
- @trigger_error(
- 'AnonymousRequestMatcher of HttpCacheBundle is deprecated. '.
- 'Use AnonymousRequestMatcher of HttpCache library.',
- E_USER_DEPRECATED
- );
-
- if (isset($options['user_identifier_headers'], $options['session_name_prefix'])) {
- parent::__construct($options);
- } else {
- parent::__construct([
- 'user_identifier_headers' => $options,
- 'session_name_prefix' => 'PHPSESSID',
- ]);
- }
- }
-}
diff --git a/tests/Functional/DependencyInjection/ServiceTest.php b/tests/Functional/DependencyInjection/ServiceTest.php
index 7901c143..2e859b39 100644
--- a/tests/Functional/DependencyInjection/ServiceTest.php
+++ b/tests/Functional/DependencyInjection/ServiceTest.php
@@ -52,10 +52,6 @@ public function testCanBeLoaded()
if (strncmp('fos_http_cache.', $id, 15)) {
continue;
}
- // skip deprecated service
- if ('fos_http_cache.user_context.logout_handler' === $id) {
- continue;
- }
$this->assertIsObject($container->get($id));
}
}
diff --git a/tests/Unit/DependencyInjection/FOSHttpCacheExtensionTest.php b/tests/Unit/DependencyInjection/FOSHttpCacheExtensionTest.php
index 611dc44a..97ce2efd 100644
--- a/tests/Unit/DependencyInjection/FOSHttpCacheExtensionTest.php
+++ b/tests/Unit/DependencyInjection/FOSHttpCacheExtensionTest.php
@@ -283,7 +283,7 @@ public function testEmptyConfig(): void
$container = $this->createContainer();
$this->extension->load([$config], $container);
- $this->assertFalse($container->has('fos_http_cache.user_context.logout_handler'));
+ $this->assertFalse($container->has('fos_http_cache.user_context.session_logout_handler'));
}
public function testConfigTagNotSupported(): void
@@ -578,7 +578,7 @@ public function testConfigUserContext(): void
$this->assertTrue($container->has('fos_http_cache.user_context.hash_generator'));
$this->assertTrue($container->has('fos_http_cache.user_context.request_matcher'));
$this->assertTrue($container->has('fos_http_cache.user_context.role_provider'));
- $this->assertTrue($container->has('fos_http_cache.user_context.logout_handler'));
+ $this->assertTrue($container->has('fos_http_cache.user_context.session_logout_handler'));
$this->assertEquals(['fos_http_cache.user_context.role_provider' => [[]]], $container->findTaggedServiceIds('fos_http_cache.user_context_provider'));
}
@@ -608,7 +608,7 @@ public function testConfigWithoutUserContext(): void
$this->assertFalse($container->has('fos_http_cache.user_context.hash_generator'));
$this->assertFalse($container->has('fos_http_cache.user_context.request_matcher'));
$this->assertFalse($container->has('fos_http_cache.user_context.role_provider'));
- $this->assertFalse($container->has('fos_http_cache.user_context.logout_handler'));
+ $this->assertFalse($container->has('fos_http_cache.user_context.session_logout_handler'));
$this->assertFalse($container->has('fos_http_cache.user_context.session_listener'));
}