From 11575ef3c416aa9c0be1ae3dfd3cad8d385a418c Mon Sep 17 00:00:00 2001 From: Mark Baker Date: Fri, 8 Feb 2019 21:08:55 +0100 Subject: [PATCH] Load locales clean folder path (#875) * Fix locale folder path when reading locale list * Ensure / directory separaor isn't left against locale name --- src/PhpSpreadsheet/Calculation/Calculation.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/PhpSpreadsheet/Calculation/Calculation.php b/src/PhpSpreadsheet/Calculation/Calculation.php index 4f9ef639..9b9fe649 100644 --- a/src/PhpSpreadsheet/Calculation/Calculation.php +++ b/src/PhpSpreadsheet/Calculation/Calculation.php @@ -2207,8 +2207,8 @@ class Calculation private static function loadLocales() { $localeFileDirectory = __DIR__ . '/locale/'; - foreach (glob($localeFileDirectory . '/*', GLOB_ONLYDIR) as $filename) { - $filename = substr($filename, strlen($localeFileDirectory) + 1); + foreach (glob($localeFileDirectory . '*', GLOB_ONLYDIR) as $filename) { + $filename = substr($filename, strlen($localeFileDirectory)); if ($filename != 'en') { self::$validLocaleLanguages[] = $filename; } @@ -2413,7 +2413,6 @@ class Calculation if (strpos($locale, '_') !== false) { list($language) = explode('_', $locale); } - if (count(self::$validLocaleLanguages) == 1) { self::loadLocales(); }