File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
src/Symfony/Component/Intl Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -68,7 +68,8 @@ public static function getDefaultFallback(): ?string
68
68
public static function getFallback (string $ locale ): ?string
69
69
{
70
70
if (\function_exists ('locale_parse ' )) {
71
- $ localeSubTags = locale_parse ($ locale );
71
+ $ localeSubTags = locale_parse ($ locale ) ?? ['language ' => $ locale ];
72
+
72
73
if (1 === \count ($ localeSubTags )) {
73
74
if ('root ' !== self ::$ defaultFallback && self ::$ defaultFallback === $ localeSubTags ['language ' ]) {
74
75
return 'root ' ;
Original file line number Diff line number Diff line change @@ -70,4 +70,16 @@ public function testDefaultRootFallback()
70
70
71
71
Locale::setDefaultFallback ($ prev );
72
72
}
73
+
74
+ /**
75
+ * @requires function locale_parse
76
+ */
77
+ public function testLongLocaleFallback ()
78
+ {
79
+ $ locale = 'LC_TYPE=fr_FR.UTF-8;LC_NUMERIC=C;LC_TIME=fr_FR.UTF-8;LC_COLLATE=fr_FR.UTF-8; ' .
80
+ 'LC_MONETARY=fr_FR.UTF-8;LC_MESSAGES=fr_FR.UTF-8;LC_PAPER=fr_FR.UTF-8;LC_NAME=fr_FR.UTF-8; ' .
81
+ 'LC_ADDRESS=fr_FR.UTF-8;LC_TELEPHONE=fr_FR.UTF-8;LC_MEASUREMENT=fr_FR.UTF-8;LC_IDENTIFICATION=fr_FR.UTF-8 ' ;
82
+
83
+ $ this ->assertNull (Locale::getFallback ($ locale ));
84
+ }
73
85
}
You can’t perform that action at this time.
0 commit comments