Skip to content

Commit 8789394

Browse files
Add support for custom cookie name filter
1 parent 23fa068 commit 8789394

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

Configuration/ConfigurationInterface.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ public function getBacktraceFolder(): string;
3434
*/
3535
public function getUserInformation(TokenInterface $token = NULL): string;
3636

37+
/**
38+
* Filters the cookie names returned by this function.
39+
* PHPSESSID & REMEMBERME are filtered by default.
40+
*
41+
* @return string[]
42+
*/
43+
public function filterCookieNames(): array;
44+
3745
/**
3846
* Retrieve the system version
3947
*

Handler/AbstractExceptionHandler.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,9 +242,10 @@ public function onKernelResponse(ResponseEvent $responseObject)
242242
$this->removeVars($request, 'headers', [
243243
'authorization', 'cookie', 'php-auth-pw',
244244
]);
245-
$this->removeVars($request, 'cookies', [
246-
'PHPSESSID', 'REMEMBERME',
247-
]);
245+
$this->removeVars($request, 'cookies', array_merge(
246+
['PHPSESSID', 'REMEMBERME'],
247+
$this->configuration->filterCookieNames(),
248+
));
248249

249250
// Get the POST variables
250251
$responseString = $response->__toString();

UPGRADE.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Upgrade notes
22

3+
# 3.1
4+
Add support for custom cookie name filtering. You will need to adjust your configuration files so they implement the `filterCookieNames` method. Return an empty array to keep the current behaviour.
5+
36
# 3.0
47
The 3.0 adds support for the Symfony mailer component, but applications using SwiftMailer are still supported.
58

0 commit comments

Comments
 (0)