Skip to content
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

Fix issue with Symfony\Translate v4.4.27 #2398

Merged
merged 1 commit into from
Jul 28, 2021
Merged

Fix issue with Symfony\Translate v4.4.27 #2398

merged 1 commit into from
Jul 28, 2021

Conversation

LukeTowers
Copy link
Contributor

This fixes an issue introduced by Symfony\Translate v4.4.27 changing the default return value of getLocale() to fallback to \Locale::getDefault() when php-intl is installed and enabled; and 'en' when it is not.

Previously, a newly initialized Translator object would have returned null from getLocale() on first initialization, which would have made this check pass. However, this change now means that the initialization that is supposed to occur from a fresh Translator calling setLocale() on itself will fail under the following conditions:

  • The locale being initialized matches the one returned by \Locale::getDefault() on systems with php-intl installed and enabled
  • Or the locale being initialized is en on systems where php-intl is not installed or enabled.

See symfony/translation@c1cca3e#commitcomment-54056868, wintercms/winter#256, and octobercms/library@ff2cec6 for more information on affected projects.

This fixes an issue introduced by Symfony\Translate v4.4.27 changing the default return value of `getLocale()` to fallback to `\Locale::getDefault()` when php-intl is installed and enabled; and `'en'` when it is not. 

Previously, a newly initialized `Translator` object would have returned `null` from `getLocale()` on first initialization, which would have made this check pass. However, this change now means that the initialization that is supposed to occur from a fresh Translator calling setLocale() on itself will fail under the following conditions:
- The locale being initialized matches the one returned by `\Locale::getDefault()` on systems with php-intl installed and enabled
- Or the locale being initialized is `en` on systems where php-intl is not installed or enabled.

See symfony/translation@c1cca3e#commitcomment-54056868, wintercms/winter#256, and octobercms/library@ff2cec6 for more information on affected projects.
@LukeTowers
Copy link
Contributor Author

@kylekatarnls if you could review this ASAP that would be greatly appreciated, this is breaking all @wintercms projects that attempt to update to the newest Symfony\Translate.

Copy link
Collaborator

@kylekatarnls kylekatarnls left a comment

Choose a reason for hiding this comment

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

Thanks. 🙏

@kylekatarnls kylekatarnls merged commit 48ebff2 into briannesbitt:master Jul 28, 2021
@LukeTowers LukeTowers deleted the patch-1 branch July 28, 2021 13:52
@LukeTowers
Copy link
Contributor Author

No problem @kylekatarnls, thanks for all your hard work on this absolutely essential piece of the PHP development scene for so many years!

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.

2 participants