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

Symfony version 3.4.20 causes infinite loop while loading translations #912

Closed
vytsci opened this issue Apr 14, 2019 · 8 comments
Closed

Comments

@vytsci
Copy link

vytsci commented Apr 14, 2019

OroLocale uses Symfony INTL and version fixed within you composer is causing infinite loop as it has bug. Bug appears in vendor/symfony/symfony/src/Symfony/Component/Intl/Data/Bundle/Reader/BundleEntryReader.php file on 81 line where $currentLocale will never be null it should be false. I dont know why version is fixed this way, but it needs to be changed.

@vytsci
Copy link
Author

vytsci commented Apr 14, 2019

Solution was to override symfony file

"autoload": {
...
"files": [
...
"src/FixMe/Symfony/Component/Intl/Data/Bundle/Reader/BundleEntryReader.php"
],
...
},

and on line 81 replace while (!empty($currentLocale)) { with while (false !== $currentLocale) {

This will make the cycle break and cache now works again.

@vytsci
Copy link
Author

vytsci commented Apr 14, 2019

The bug occurs after new php intl update. Somehow it returns wrong data. On my laptop where php intl is older everything works and on my work PC I need this workaround.

@vtsykun
Copy link
Contributor

vtsykun commented Apr 14, 2019

Fixed in symfony/symfony 3.4.24 symfony/symfony#30781.

libicu 64.1 is responsible for this change. After updating php version 7.1.26 => 7.1.28 it uses another version libicu http://site.icu-project.org/download/64.

Migration Issues
The locale ID handling for "", "und" and "root" has been made consistent across Java, 
C++, and C. In particular, Locale.getLanguage() will return the empty string for each 
of these now, Locale("und_IN").getName() will be "_IN" for consistency, etc. 
This might require some adjustments.

php 7.1.28

intl
ICU version => 64.1

php 7.1.26

intl
ICU version => 60.2

To fix you can apply patch

diff --git a/src/Symfony/Component/Intl/Locale.php b/src/Symfony/Component/Intl/Locale.php
index a9c36ec618b5..6e88c5629e00 100644
--- a/src/Symfony/Component/Intl/Locale.php
+++ b/src/Symfony/Component/Intl/Locale.php
@@ -85,7 +85,9 @@ public static function getFallback($locale)
 
             array_pop($localeSubTags);
 
-            return locale_compose($localeSubTags);
+            $fallback = locale_compose($localeSubTags);
+
+            return false !== $fallback ? $fallback : null;
         }
 
         if (false !== $pos = strrpos($locale, '_')) {

@vytsci
Copy link
Author

vytsci commented Apr 14, 2019

OK thank you. Strange issue.

@anyt
Copy link
Contributor

anyt commented Apr 15, 2019

Internal ticket id BAP-18262, BAP-18759

@klaussilveira
Copy link

Any news on this?

@aivus
Copy link
Contributor

aivus commented Jun 11, 2019

@klaussilveira it was fixed in platform 3.1.8

@klaussilveira
Copy link

Fixed in: 75efd99

This should have been included in the changelog, given the importance of this bug. Can you close the ticket then? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

6 participants