🌐 AI搜索 & 代理 主页
Skip to content

Conversation

@longwave
Copy link
Contributor

@longwave longwave commented Oct 31, 2025

Q A
Branch? 6.4
Bug fix? yes
New feature? no
Deprecations? no
Issues Fix #62226
License MIT

Since #61267 some additional MIME formats are predefined; in order to override the predefined formats you must explictly deregister them. This PR changes the order so formats added later take precedence.

@longwave
Copy link
Contributor Author

longwave commented Oct 31, 2025

Psalm failed because $format is nullable, but why is this allowed? What does it mean to pass null?

Perhaps this was a mistake in https://github.com/symfony/symfony/pull/33088/files#diff-779a02ff90f6fc60228d531d684382d3b585b3c823ba53028ff8d2a9e03a2ea0R1314

@nicolas-grekas nicolas-grekas modified the milestones: 7.4, 6.4 Oct 31, 2025
Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I rebased the PR on branch 6.4 because the root issue exists there: the last calls to setFormat should replace the previous ones.
I also updated the implementation to fix this in getFormat instead.

@stof
Copy link
Member

stof commented Oct 31, 2025

I have no idea why setFormat supports null as format. This should probably be deprecated (in a separate PR as we cannot deprecate things in 6.4)

@stof
Copy link
Member

stof commented Oct 31, 2025

This looks like a mistake when adding the native type, as the old code was using @param string $format:

* @param string $format The format
* @param string|array $mimeTypes The associated mime types (the preferred one must be the first as it will be used as the content type)
*/
public function setFormat($format, $mimeTypes)

@nicolas-grekas
Copy link
Member

Thank you @longwave.

@nicolas-grekas nicolas-grekas merged commit 6c6d8ed into symfony:6.4 Nov 1, 2025
10 of 11 checks passed
This was referenced Nov 2, 2025
nicolas-grekas added a commit that referenced this pull request Nov 2, 2025
…est::setFormat() (longwave)

This PR was squashed before being merged into the 7.4 branch.

Discussion
----------

[HttpFoundation] Deprecate null $format argument to Request::setFormat()

| Q             | A
| ------------- | ---
| Branch?       | 7.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | yes
| Issues        | no
| License       | MIT

Deprecates null `$format` argument to `Request::setFormat()` - as discovered in #62246 it makes no sense for this argument to be nullable.

Commits
-------

7b18f1a [HttpFoundation] Deprecate null $format argument to Request::setFormat()
This was referenced Nov 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[HttpFoundation] Regression in Request::getFormat() where new MIME types were already registered

4 participants