Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[HttpFoundation][HttpKernel] Reset request formats after each main request #59047

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

dwgebler
Copy link

Add public static method to reset Request format to mime mappings Reset Request format to mime mappings on Kernel boot for each new main request

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

Adds a new public static method to Request to reset the mappings of formats to MIME types. Adds a call to this method just before resetting services in Kernel::boot().

Add public static method to reset Request format to mime mappings
Reset Request format to mime mappings on Kernel boot for each new main
request
@carsonbot carsonbot added this to the 7.3 milestone Nov 30, 2024
@carsonbot carsonbot changed the title [HttpFoundation] [HttpKernel] Reset request formats after each main request [HttpFoundation][HttpKernel] Reset request formats after each main request Nov 30, 2024
*/
public static function resetFormats(): void
{
static::$formats = null;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
static::$formats = null;
static::initializeFormats();

This is a micro-optimization, but this will save some time when handling the next request.

Copy link
Author

Choose a reason for hiding this comment

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

@dunglas I considered doing it this way originally but my feeling was because the initial state of $formats is null, that's what we should set it back to as a reset., because that's the change that interferes least with the implementation details of the rest of the class. Happy to change it in accordance with your suggestion if you like.

@dunglas
Copy link
Member

dunglas commented Dec 1, 2024

This should be merged in 6.4 as it's (mostly) a bug fix.

Fix typo in function docblock

Co-authored-by: Kévin Dunglas <[email protected]>
@dwgebler
Copy link
Author

dwgebler commented Dec 1, 2024

This should be merged in 6.4 as it's (mostly) a bug fix.

@dunglas See #59053 and this PR can be closed then.

@dwgebler
Copy link
Author

dwgebler commented Dec 1, 2024

Closing as superseded by #59053

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] static Request::$formats can't be reset which causes issues in worker mode
3 participants