Skip to content

Commit

Permalink
FIX Create a temp locale if there is not a default
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Jun 6, 2024
1 parent eaece0a commit 2714bff
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Extension/FluentExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -1055,6 +1055,14 @@ public function LocaleInformation($locale = null)
$localeObj = Locale::getDefault();
}

if (!$locale && !$localeObj) {
// There is no default locale, this can happen when if fluent is installed though locales have been setup
// This will happen when doing integration unit testing, though can also happen during
// regular website operation
// This temporary Locale is created to prevent a invalid argument exception in RecordLocale::__construct()
$localeObj = Locale::create(['Title' => 'Temp locale']);
}

return RecordLocale::create($this->owner, $localeObj);
}

Expand Down

0 comments on commit 2714bff

Please sign in to comment.