-
-
Notifications
You must be signed in to change notification settings - Fork 367
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
Locale matcher can fail when client provided locale identifier has incorrect casing #1087
Labels
Milestone
Comments
Silic0nS0ldier
added
confirmed bug
Something isn't working
internationalization
Related to the localization feature
labels
Apr 23, 2020
Entirely untested prototype fix // Ensure locale available
$localeIndex = array_search(strtolower($identifier), array_map('strtolower', $availableLocales));
if ($localeIndex !== -1) {
$matchedLocale = $availableLocales[$localeIndex];
// Determine preference level (q=0.x), and add to $foundLocales
// If no preference level, set as 1
if (array_key_exists(1, $parts)) {
$preference = str_replace('q=', '', $parts[1]);
$preference = (float) $preference; // Sanitize with int cast (bad values go to 0)
} else {
$preference = 1;
}
// Add to list, and format for UF's i18n.
$foundLocales[$matchedLocale] = $preference;
} |
Isn't that handled by the |
Ok I see. A test with
|
lcharette
added a commit
to lcharette/UserFrosting
that referenced
this issue
Apr 23, 2020
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
UserFrosting/app/sprinkles/core/src/I18n/SiteLocale.php
Lines 172 to 186 in f1d0d7a
We need to update how the identifier to handled to ensure issues don't occur on case sensitive file systems. Ideally the value used would come from the locale matcher array to avoid excessive value processing.
The text was updated successfully, but these errors were encountered: