Skip to content

Commit ce78489

Browse files
Merge pull request #10 from webfactory/feature/decode_cookie_values
Decode legacy cookie values
2 parents 913d2e0 + 39ef254 commit ce78489

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Integration/LegacyCaptureResponseFactory.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public static function create($legacyExecutionCallback)
4848
$cookies = array();
4949

5050
foreach ($headers as $header) {
51-
$header = preg_match('(^([^:]+):(.*)$)', $header, $matches);
51+
preg_match('(^([^:]+):(.*)$)', $header, $matches);
5252
$headerName = strtolower(trim($matches[1]));
5353
$headerValue = trim($matches[2]);
5454

@@ -85,13 +85,14 @@ private static function createCookieFromString($cookie, $url = null)
8585

8686
$values = array(
8787
'name' => trim($name),
88-
'value' => trim($value),
88+
// Cookie value must be decoded, otherwise it is encoded again when we forward it to the Symfony response.
89+
// That would lead to problems, for example with session cookies whose id can contain a comma.
90+
'value' => trim(urldecode($value)),
8991
'expires' => 0,
9092
'path' => '/',
9193
'domain' => '',
9294
'secure' => false,
93-
'httponly' => false,
94-
'passedRawValue' => true,
95+
'httponly' => false
9596
);
9697

9798
if (null !== $url) {

0 commit comments

Comments
 (0)