Skip to content

Commit

Permalink
prevent applying str_contains on null value
Browse files Browse the repository at this point in the history
  • Loading branch information
solverat committed Oct 30, 2024
1 parent c7381c1 commit d4f0cc4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Upgrade Notes

## 5.1.1
- [IMPROVEMENT] prevent applying str_contains on null value
## 5.1.0
- [FEATURE] pimcore backend: object preview button
## 5.0.6
Expand Down
4 changes: 2 additions & 2 deletions src/Manager/I18nContextManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,10 @@ protected function buildLocaleDefinition(RouteItemInterface $routeItem): LocaleD
$languageIso = $locale;
$countryIso = Definitions::INTERNATIONAL_COUNTRY_NAMESPACE;

if (str_contains($baseLocale, '_')) {
if ($baseLocale !== null && str_contains($baseLocale, '_')) {
$parts = explode('_', $baseLocale);
$languageIso = strtolower($parts[0]);
if (isset($parts[1]) && !empty($parts[1])) {
if (!empty($parts[1])) {
$countryIso = strtoupper($parts[1]);
}
}
Expand Down

0 comments on commit d4f0cc4

Please sign in to comment.