Skip to content
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 Setup in admin throws in_array error when a single value is selected #8076

Closed
deriknel opened this issue Jan 9, 2017 · 4 comments
Closed
Assignees
Labels
bug report Component: Tax Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Progress: needs update

Comments

@deriknel
Copy link
Contributor

deriknel commented Jan 9, 2017

Preconditions

  1. Magento ver. 2.1.3
  2. Ubuntu 16.04
  3. PHP 7.0.8-0ubuntu0.16.04.3 ( NTS )
  4. MySQL Ver 15.1 Distrib 10.0.28-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

Steps to reproduce

  1. In admin navigate to configuration
  2. General -> Currency Setup
  3. Select a single value in the multiple selects
  4. Click on save

Expected result

  1. Currency values should update as per selection

Actual result

  1. Something went wrong while saving this configuration: Warning: in_array() expects parameter 2 to be array, string given in /var/www/clean-m2-ee/vendor/magento/module-config/Model/Config/Backend/Currency/DefaultCurrency.php on line 30

This is because the $this->_getAllowedCurrencies() method returns a string for single values and not an array as expected. Typecasting that to an array would fix this:

if (!in_array($this->getValue(), (array)$this->_getAllowedCurrencies())) {

Or alternatively update the methods to always return arrays.

@veloraven
Copy link
Contributor

@deriknel thank you for your report.
I was not able to reproduce this issue.
Could you please provide more details?

  1. Full description for currencies setup: for base, default displayed and allowed currencies.
  2. What level of scope do you use?
  3. What Magento mode do you use?
  4. Was it clear install or upgrade from some other version?

@deriknel
Copy link
Contributor Author

deriknel commented Jan 12, 2017 via email

@okorshenko
Copy link
Contributor

Closing this issue. PR #8077 was delivered to develop branch

@magento-team magento-team added 2.1.x Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development bug report Progress: needs update Component: Tax labels Jul 31, 2017
@magento-team
Copy link
Contributor

Internal ticket to track issue progress: MAGETWO-65003

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report Component: Tax Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Progress: needs update
Projects
None yet
Development

No branches or pull requests

5 participants