diff --git a/vendor/magento/module-currency-symbol/Model/System/Currencysymbol.php b/vendor/magento/module-currency-symbol/Model/System/Currencysymbol.php index 400aa56bc68..f3b3c46ca7f 100644 --- a/vendor/magento/module-currency-symbol/Model/System/Currencysymbol.php +++ b/vendor/magento/module-currency-symbol/Model/System/Currencysymbol.php @@ -27,14 +27,14 @@ class Currencysymbol protected $_symbolsData = []; /** - * Store id + * Current store id * * @var string|null */ protected $_storeId; /** - * Website id + * Current website id * * @var string|null */ @@ -55,19 +55,19 @@ class Currencysymbol /** * Config path to custom currency symbol value */ - const XML_PATH_CUSTOM_CURRENCY_SYMBOL = 'currency/options/customsymbol'; + public const XML_PATH_CUSTOM_CURRENCY_SYMBOL = 'currency/options/customsymbol'; - const XML_PATH_ALLOWED_CURRENCIES = \Magento\Directory\Model\Currency::XML_PATH_CURRENCY_ALLOW; + public const XML_PATH_ALLOWED_CURRENCIES = \Magento\Directory\Model\Currency::XML_PATH_CURRENCY_ALLOW; /* * Separator used in config in allowed currencies list */ - const ALLOWED_CURRENCIES_CONFIG_SEPARATOR = ','; + public const ALLOWED_CURRENCIES_CONFIG_SEPARATOR = ','; /** * Config currency section */ - const CONFIG_SECTION = 'currency'; + public const CONFIG_SECTION = 'currency'; /** * Core event manager proxy @@ -174,11 +174,11 @@ class Currencysymbol if (isset($currentSymbols[$code]) && !empty($currentSymbols[$code])) { $this->_symbolsData[$code]['displaySymbol'] = $currentSymbols[$code]; + $this->_symbolsData[$code]['inherited'] = false; } else { $this->_symbolsData[$code]['displaySymbol'] = $this->_symbolsData[$code]['parentSymbol']; + $this->_symbolsData[$code]['inherited'] = true; } - $this->_symbolsData[$code]['inherited'] = - ($this->_symbolsData[$code]['parentSymbol'] == $this->_symbolsData[$code]['displaySymbol']); } return $this->_symbolsData; @@ -193,8 +193,8 @@ class Currencysymbol public function setCurrencySymbolsData($symbols = []) { if (!$this->_storeManager->isSingleStoreMode()) { - foreach ($this->getCurrencySymbolsData() as $code => $values) { - if (isset($symbols[$code]) && ($symbols[$code] == $values['parentSymbol'] || empty($symbols[$code]))) { + foreach (array_keys($this->getCurrencySymbolsData()) as $code) { + if (isset($symbols[$code]) && empty($symbols[$code])) { unset($symbols[$code]); } } diff --git a/vendor/magento/module-directory/Model/Currency.php b/vendor/magento/module-directory/Model/Currency.php index 8891902d437..721afe5b8ec 100644 --- a/vendor/magento/module-directory/Model/Currency.php +++ b/vendor/magento/module-directory/Model/Currency.php @@ -444,7 +444,7 @@ class Currency extends \Magento\Framework\Model\AbstractModel to bypass issue when preg_replace with Arabic symbol return corrupted result */ $formattedCurrency = preg_replace(['/[^0-9\x{0600}-\x{06FF}.,۰٫]+/u', '/ /'], '', $formattedCurrency); } else { - $formattedCurrency = preg_replace(['/[^0-9.,۰٫]+/', '/ /'], '', $formattedCurrency); + $formattedCurrency = str_replace(' ', '', $formattedCurrency); } } @@ -459,13 +459,11 @@ class Currency extends \Magento\Framework\Model\AbstractModel */ private function getNumberFormatter(array $options): \Magento\Framework\NumberFormatter { - $key = 'currency_' . hash( - 'sha256', - ($this->localeResolver->getLocale() . $this->serializer->serialize($options)) - ); + $locale = $this->localeResolver->getLocale() . ($this->getCode() ? '@currency=' . $this->getCode() : ''); + $key = 'currency_' . hash('sha256', $locale . $this->serializer->serialize($options)); if (!isset($this->numberFormatterCache[$key])) { $this->numberFormatter = $this->numberFormatterFactory->create( - ['locale' => $this->localeResolver->getLocale(), 'style' => \NumberFormatter::CURRENCY] + ['locale' => $locale, 'style' => \NumberFormatter::CURRENCY] ); $this->setOptions($options);