Skip to content

Commit 602c16d

Browse files
committed
Merge branch '7.0' into 7.1
* 7.0: Update serializer.rst Update access_token.rst, removed letter [HttpClient] Fix how cookies are defined and sent
2 parents fd7b8ea + d4fe4cf commit 602c16d

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

components/serializer.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -757,7 +757,7 @@ When serializing, you can set a callback to format a specific object property::
757757

758758
// all callback parameters are optional (you can omit the ones you don't use)
759759
$dateCallback = function (object $innerObject, object $outerObject, string $attributeName, ?string $format = null, array $context = []): string {
760-
return $innerObject instanceof \DateTime ? $innerObject->format(\DateTime::ISO8601) : '';
760+
return $innerObject instanceof \DateTime ? $innerObject->format(\DateTime::ATOM) : '';
761761
};
762762

763763
$defaultContext = [

http_client.rst

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -687,17 +687,21 @@ cookies automatically.
687687

688688
You can either :ref:`send cookies with the BrowserKit component <component-browserkit-sending-cookies>`,
689689
which integrates seamlessly with the HttpClient component, or manually setting
690-
the ``Cookie`` HTTP header as follows::
690+
`the Cookie HTTP request header`_ as follows::
691691

692692
use Symfony\Component\HttpClient\HttpClient;
693693
use Symfony\Component\HttpFoundation\Cookie;
694694

695695
$client = HttpClient::create([
696696
'headers' => [
697-
'Cookie' => new Cookie('flavor', 'chocolate', strtotime('+1 day')),
697+
// set one cookie as a name=value pair
698+
'Cookie' => 'flavor=chocolate',
698699

699-
// you can also pass the cookie contents as a string
700-
'Cookie' => 'flavor=chocolate; expires=Sat, 11 Feb 2023 12:18:13 GMT; Max-Age=86400; path=/'
700+
// you can set multiple cookies at once separating them with a ;
701+
'Cookie' => 'flavor=chocolate; size=medium',
702+
703+
// if needed, encode the cookie value to ensure that it contains valid characters
704+
'Cookie' => sprintf("%s=%s", 'foo', rawurlencode('...')),
701705
],
702706
]);
703707

@@ -2360,3 +2364,4 @@ you to do so, by yielding the exception from its body::
23602364
.. _`SSRF`: https://portswigger.net/web-security/ssrf
23612365
.. _`RFC 6570`: https://www.rfc-editor.org/rfc/rfc6570
23622366
.. _`HAR`: https://w3c.github.io/web-performance/specs/HAR/Overview.html
2367+
.. _`the Cookie HTTP request header`: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cookie

security/access_token.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ This handler must implement
9999

100100
// and return a UserBadge object containing the user identifier from the found token
101101
// (this is the same identifier used in Security configuration; it can be an email,
102-
// a UUUID, a username, a database ID, etc.)
102+
// a UUID, a username, a database ID, etc.)
103103
return new UserBadge($accessToken->getUserId());
104104
}
105105
}

0 commit comments

Comments
 (0)