Skip to content

[9.x] Fix overriding global locale#43426

Merged
taylorotwell merged 4 commits into
9.xfrom
fix-overriding-locale
Jul 26, 2022
Merged

[9.x] Fix overriding global locale#43426
taylorotwell merged 4 commits into
9.xfrom
fix-overriding-locale

Conversation

@driesvints

@driesvints driesvints commented Jul 26, 2022

Copy link
Copy Markdown
Member

This PR fixes a bug where the global Locale value would be overwritten by calling setLocale. Underneath this method, Symfony sets the global Locale. Since we're not initializing the original request of the application but
rather copying an existing request, we need to prevent from overwriting the default PHP locale. We can achieve this by just setting the plain locale and plain default locale without modifying the PHP locale. I've added new methods to achieve this so there's no side effects.

Fixes #43371

@driesvints driesvints changed the title Fix overriding global locale [9.x] Fix overriding global locale Jul 26, 2022
@taylorotwell taylorotwell merged commit 41ecd77 into 9.x Jul 26, 2022
@taylorotwell taylorotwell deleted the fix-overriding-locale branch July 26, 2022 13:16
Ken-vdE pushed a commit to Ken-vdE/framework that referenced this pull request Aug 9, 2022
* Fix overriding global locale

* wip

* formatting

* Update Request.php

Co-authored-by: Taylor Otwell <taylor@laravel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Using a custom FormRequest always modify the language of \Locale class from intl PHP extension

2 participants