Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix exception when convert Request to string
In some application like https://github.com/shopware/platform , they will store some data in cookie by an array struct.
It will throw an Exception when we try to log the request.
This PR fix it.
  • Loading branch information
tourze authored Nov 25, 2022
commit 28ad9ebbcada2a3c348a408025a3d8647d36bf52
8 changes: 7 additions & 1 deletion src/Symfony/Component/HttpFoundation/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,13 @@ public function __toString(): string
$cookies = [];

foreach ($this->cookies as $k => $v) {
$cookies[] = $k.'='.$v;
if (is_array($v)) {
foreach ($v as $_k => $_v) {
$cookies[] = "{$k}[{$_k}]={$_v}";
}
} else {
$cookies[] = $k.'='.$v;
}
}

if (!empty($cookies)) {
Expand Down