Skip to content

Commit d4fe4cf

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

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
@@ -724,7 +724,7 @@ When serializing, you can set a callback to format a specific object property::
724724

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

730730
$defaultContext = [

http_client.rst

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

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

684684
use Symfony\Component\HttpClient\HttpClient;
685685
use Symfony\Component\HttpFoundation\Cookie;
686686

687687
$client = HttpClient::create([
688688
'headers' => [
689-
'Cookie' => new Cookie('flavor', 'chocolate', strtotime('+1 day')),
689+
// set one cookie as a name=value pair
690+
'Cookie' => 'flavor=chocolate',
690691

691-
// you can also pass the cookie contents as a string
692-
'Cookie' => 'flavor=chocolate; expires=Sat, 11 Feb 2023 12:18:13 GMT; Max-Age=86400; path=/'
692+
// you can set multiple cookies at once separating them with a ;
693+
'Cookie' => 'flavor=chocolate; size=medium',
694+
695+
// if needed, encode the cookie value to ensure that it contains valid characters
696+
'Cookie' => sprintf("%s=%s", 'foo', rawurlencode('...')),
693697
],
694698
]);
695699

@@ -2291,3 +2295,4 @@ you to do so, by yielding the exception from its body::
22912295
.. _`SSRF`: https://portswigger.net/web-security/ssrf
22922296
.. _`RFC 6570`: https://www.rfc-editor.org/rfc/rfc6570
22932297
.. _`HAR`: https://w3c.github.io/web-performance/specs/HAR/Overview.html
2298+
.. _`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)