-
Notifications
You must be signed in to change notification settings - Fork 641
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Currency formatter InvalidConfigException #6277
Comments
I’m not able to reproduce this, but appears to be a Yii bug with |
@brandonkelly this one has cropped up again for me, I did some digging in the Yii slack channel and feedback suggested it could well be a configuration issue. I have narrowed it down to decimal strings as it only throws the exception if passed a string with decimal And if I override the configuration (just using the example in the Yii docs) then the issue goes away, https://www.yiiframework.com/doc/guide/2.0/en/output-formatting#configuring-formatter |
The formatter config is provided by the locale, so not something we can tweak. |
It doesn't look like the locale config is setting a Should the locale not be setting that? |
We do in fact set that, if the Intl extension is not installed. Otherwise it’s not needed since the Intl extension will handle it automatically. Just tested and works as expected on my end. What locale is your site set to? Most locales don’t actually specify a currency. |
Set to en-GB |
Maybe something is wrong with your Intl extension, then. |
It was, finally had a chance to get everything updated locally and all resolved, thanks. |
Description
Running into an odd error (reported in the commerce repo craftcms/commerce#1541) but it think it might be an issue with the core.
Looks to be caused when a string rather than float / number is passed to the currency formatter:
Craft::$app->getFormatter()->asCurrency('26.3')
Throws:
The default currency code for the formatter is not defined.
Error suggests the config exception is thrown from the
asCurrencyStringFallback()
Steps to reproduce
Additional info
The text was updated successfully, but these errors were encountered: