Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions UPGRADE-7.4.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ HttpFoundation
* Deprecate using `Request::sendHeaders()` after headers have already been sent; use a `StreamedResponse` instead
* Deprecate method `Request::get()`, use properties `->attributes`, `query` or `request` directly instead
* Deprecate HTTP method override for methods GET, HEAD, CONNECT and TRACE; it will be ignored in Symfony 8.0
* Deprecate accepting null `$format` argument to `Request::setFormat()`

HttpKernel
----------
Expand Down
1 change: 1 addition & 0 deletions src/Symfony/Component/HttpFoundation/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ CHANGELOG
* Deprecate method `Request::get()`, use properties `->attributes`, `query` or `request` directly instead
* Make `Request::createFromGlobals()` parse the body of PUT, DELETE, PATCH and QUERY requests
* Deprecate HTTP method override for methods GET, HEAD, CONNECT and TRACE; it will be ignored in Symfony 8.0
* Deprecate accepting null `$format` argument to `Request::setFormat()`

7.3
---
Expand Down
8 changes: 7 additions & 1 deletion src/Symfony/Component/HttpFoundation/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -1369,15 +1369,21 @@ public function getFormat(?string $mimeType/* , bool $subtypeFallback = false */
/**
* Associates a format with mime types.
*
* @param string $format The format to set
* @param string|string[] $mimeTypes The associated mime types (the preferred one must be the first as it will be used as the content type)
*/
public function setFormat(?string $format, string|array $mimeTypes): void
{
if (null === $format) {
trigger_deprecation('symfony/http-foundation', '7.4', 'Passing "null" as the first argument of "%s()" is deprecated. The argument will be non-nullable in Symfony 8.0.', __METHOD__);
$format = '';
}

if (null === static::$formats) {
static::initializeFormats();
}

static::$formats[$format ?? ''] = (array) $mimeTypes;
static::$formats[$format] = (array) $mimeTypes;
}

/**
Expand Down
Loading