Skip to content

Conversation

@Spomky
Copy link
Contributor

@Spomky Spomky commented Jul 30, 2025

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

Extended MIME type handling in Request::getFormat() to support structured suffixes like application/soap+xml. Introduced a private method to define fallback formats based on RFC specifications. Updated the test suite accordingly.
It adds supports for common mime types:

  • soap: application/soap+xml (instead of xml)
  • problem: application/problem+json
  • hal: application/hal+json, application/hal+xml
  • jsonapi: application/vnd.api+json
  • yaml: text/yaml, application/x-yaml
  • wbxml: application/vnd.wap.wbxml
  • pdf: application/pdf
  • csv: text/csv

@Spomky Spomky force-pushed the features/hybrid-mime-format branch 2 times, most recently from a7beaed to 89470ad Compare July 30, 2025 20:00
Expanded the MIME type list in `Request::getMimeTypes()` to include mappings for YAML, WBXML, PDF, and CSV formats.
@Spomky Spomky force-pushed the features/hybrid-mime-format branch from 309a6b7 to f2ba0b3 Compare August 20, 2025 06:36
@fabpot
Copy link
Member

fabpot commented Aug 20, 2025

Thank you @Spomky.

@fabpot fabpot merged commit e0365cc into symfony:7.4 Aug 20, 2025
4 of 12 checks passed
nicolas-grekas added a commit that referenced this pull request Aug 20, 2025
…MatTheCat)

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

Discussion
----------

[HttpFoundation] Don’t check suffix on empty MIME type

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

Fix tests from #61267 (remaining failures unrelated).

Commits
-------

3816617 [HttpFoundation] Don’t check suffix on empty MIME type
@xabbuh
Copy link
Member

xabbuh commented Aug 27, 2025

Adding the new argument to the getFormat() method is a BC break. Has this been discussed?

@Spomky
Copy link
Contributor Author

Spomky commented Aug 27, 2025

Adding the new argument to the getFormat() method is a BC break. Has this been discussed?

Indeed it is not in line with Adding an Argument to a Public Method.
Let me fix that.

@nicolas-grekas
Copy link
Member

nicolas-grekas commented Aug 27, 2025

While at it, maybe turn the added private method into a constant?

Spomky added a commit to Spomky/symfony that referenced this pull request Aug 28, 2025
@Spomky Spomky deleted the features/hybrid-mime-format branch August 28, 2025 07:25
@Spomky
Copy link
Contributor Author

Spomky commented Aug 28, 2025

Hi,
Please see #61544. It addresses your comments.
Kind regards

Spomky added a commit to Spomky/symfony that referenced this pull request Aug 28, 2025
Spomky added a commit to Spomky/symfony that referenced this pull request Aug 28, 2025
nicolas-grekas added a commit that referenced this pull request Aug 28, 2025
…tructured suffix formats as constant (Spomky)

This PR was merged into the 7.4 branch.

Discussion
----------

[HttpFoundation] Fix BC Break introduces in `#61267` and structured suffix formats as constant

| Q             | A
| ------------- | ---
| Branch?       | 7.4
| Bug fix?      | no
| New feature?  | no <!-- if yes, also update src/**/CHANGELOG.md -->
| Deprecations? | no <!-- if yes, also update UPGRADE-*.md and src/**/CHANGELOG.md -->
| Issues        | Fix #... <!-- prefix each issue number with "Fix #"; no need to create an issue if none exists, explain below -->
| License       | MIT

<!--
🛠️ Replace this text with a concise explanation of your change:
- What it does and why it's needed
- A simple example of how it works (include PHP, YAML, etc.)
- If it modifies existing behavior, include a before/after comparison

Contributor guidelines:
- ✅ Add tests and ensure they pass
- 🐞 Bug fixes must target the **lowest maintained** branch where they apply
  https://symfony.com/releases#maintained-symfony-branches
- ✨ New features and deprecations must target the **feature** branch
  and must add an entry to the changelog file of the patched component:
  https://symfony.com/doc/current/contributing/code/conventions.html#writing-a-changelog-entry
- 🔒 Do not break backward compatibility:
  https://symfony.com/bc
-->

Commits
-------

aec348d [HttpFoundation] Fix BC Break introduces in `#61267` and structured suffix formats as constant
This was referenced Oct 27, 2025
nicolas-grekas added a commit that referenced this pull request Nov 1, 2025
…edefined formats (longwave)

This PR was merged into the 6.4 branch.

Discussion
----------

[HttpFoundation] Allow Request::setFormat() to override predefined formats

| 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.

Commits
-------

2402d16 [HttpFoundation] Allow Request::setFormat() to override predefined formats
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.

6 participants