Skip to content
Snippets Groups Projects
Commit 3326bebb authored by Tim van Dijen's avatar Tim van Dijen
Browse files

Fix exception when translations-file does not exist

parent e6325267
No related branches found
No related tags found
No related merge requests found
......@@ -5,6 +5,12 @@
This document lists the changes between versions of SimpleSAMLphp.
See the upgrade notes for specific information about upgrading.
## Version 2.0.3
Released TBD
* Fix exception when translation-file does not exist
## Version 2.0.2
Released 2023-03-10
......
......@@ -18,7 +18,6 @@ use Gettext\Translator;
use Gettext\TranslatorFunctions;
use SimpleSAML\Configuration;
use SimpleSAML\Logger;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\HttpFoundation\File\File;
class Localization
......@@ -72,11 +71,6 @@ class Localization
*/
private string $langcode;
/**
* @var \Symfony\Component\Filesystem\Filesystem
*/
private Filesystem $fileSystem;
/**
* Constructor
......@@ -85,7 +79,6 @@ class Localization
*/
public function __construct(Configuration $configuration)
{
$this->fileSystem = new Filesystem();
$this->configuration = $configuration;
/** @var string $locales */
$locales = $this->configuration->resolvePath('locales');
......@@ -250,7 +243,7 @@ class Localization
}
$file = new File($langPath . $domain . '.po', false);
if ($this->fileSystem->exists($file->getRealPath()) && $file->isReadable()) {
if ($file->getRealPath() !== false && $file->isReadable()) {
$translations = (new PoLoader())->loadFile($file->getRealPath());
$arrayGenerator = new ArrayGenerator();
$this->translator->addTranslations(
......@@ -268,7 +261,7 @@ class Localization
/**
* Set up L18N if configured or fallback to old system
* Set up L18N
*/
private function setupL10N(): void
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment