magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.47k stars 9.28k forks source link

Config Parsing Fails - Brain Tree - invalid argument supplied for foreach() #12298

Closed ghost closed 6 years ago

ghost commented 6 years ago

Preconditions

  1. Mag 2.2.1
  2. On System .*

Steps to reproduce

  1. Configure Braintree payment system
  2. magento app:config:dump
  3. change a configuration value in admin
  4. magento setup:upgrade

Expected result

  1. config is parsed and loaded into magento

Actual result

  1. parse fails
joni-jones commented 6 years ago

@cloverbox, please, provide more details, like errors from exceptions.log, error stack trace, etc. Unfortunately, your description is not enough to understand what is wrong.

magento-engcom-team commented 6 years ago

@cloverbox, we are closing this issue due to inactivity. If you'd like to update it, please reopen the issue.

giacmir commented 6 years ago

I had the same problem recently. Reported error is

Import failed: Warning: Invalid argument supplied for foreach() in /var/www/html/vendor/magento/module-braintree/Model/Adminhtml/System/Config/CountryCreditCard.php on line 70

@magento-engcom-team @joni-jones Can you reopen this please?

daniloargentiero commented 6 years ago

We are preparing a pull request to fix this issue.

bluvertigo commented 6 years ago

Me and @DaniloEmpire have created a module to fix this issue: https://github.com/magespecialist/m2-MSP_FixBraintreeConfig

KevinFontus commented 6 years ago

@bluvertigo I tried this fix but its not working for me. I'm getting the below error while doing setup:upgrade

Plugin class MSP\FixBraintreeConfig\Plugin\Model\Adminhtml\System\Config\CountryCreditCardPlugin doesn't exist

ghost commented 6 years ago

I solved my problem with this issue by manually deleting the sections of the config that cause the failure then manually resetting the Braintree configs

Aside: It seems your team is using a non standard build chain that has diverged enough from the main branch that you can`t reproduce any of these bugs correctly.

Most of the bugs that are being closed as not reproducible arise by simply installing the default framework and test data ...

SD-dthompson commented 6 years ago

I got past this by changing

'countrycreditcard' => '[]', to 'countrycreditcard' => [], in app/etc/config.php (the array brackets should not be wrapped in quotes)

al1357 commented 6 years ago

I 'quick-fixed' it by going to /magento/module-braintree/Model/Adminhtml/System/Config/CountryCreditCard.php on line 70 and wrapping

foreach ($value as $data) { ... }

in

if(is_array($value)) { ... }

then I run app:config:import once; removed if; re-run setup:upgrade. Seems to work well for now.

ghost commented 6 years ago

thank you

muckee commented 6 years ago

@al1357 can you confirm whether this will impact the braintree module's functionality at all? I use it in my setup so don't want to try this if it's going to disable use of the module. TIA!

ghost commented 6 years ago

I can tell you that it should not, but if you have a test suite to run against it I would. I have not had any problems with it but have often and mysteriously had to manually reconfigure the brain tree settings.

On Mon, Aug 13, 2018 at 2:19 PM, Joshua Flood notifications@github.com wrote:

@al1357 https://github.com/al1357 can you confirm whether this will impact the braintree module's functionality at all? I use it in my setup so don't want to try this if it's going to disable use of the module. TIA!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/magento/magento2/issues/12298#issuecomment-412614818, or mute the thread https://github.com/notifications/unsubscribe-auth/ALhdxOxiC6AcoEhVY1iQPSG-bvM-1PbXks5uQcMkgaJpZM4QgB-G .

al1357 commented 6 years ago

@JoshuaFlood sorry, the module is not is use on our installation so I can't tell.

zukovasmartynas commented 5 years ago

Does any one knows if this was fixed in further releases ( higher than 2.2.5) ? We have the same issue with 2.2.5 version

Fix by manually removing quotes Fix by manually removing quotes has worked for us, but we are not going to do that everytime.

t-heuser commented 3 years ago

This issue still exists in Magento 2.4.0. Wow. Please someone reopen this issue and fix it asap. Makes deployment pipelines unusable with magento as you need to import config if you use a separate build server, as it's described in the magento devdocs (https://devdocs.magento.com/guides/v2.4/config-guide/deployment/pipeline/technical-details.html#production-system)

t-heuser commented 3 years ago

The error is still existing in Magento 2.4.1. @magento-engcom-team @joni-jones Can you reopen this please?

hanhpv commented 3 years ago

Can confirm, still exists in 2.4.1 The fix from @SD-dthompson works.

tim-breitenstein-it commented 3 years ago

Can confirm, still exists in 2.4.2

ssx commented 2 years ago

Still exists in 2.4.3-p1.

AlekseyKorzun commented 2 years ago

Still an issue as of today – on latest Adobe Commerce. What is the latest?

dekiakbar commented 2 years ago

The issue still exis in magento version 2.4.3.0-patch1

danharper83 commented 10 months ago

Issue still happening when trying to upgrade 2.4.2 => 2.4.4, 6 years strong.

greenleafmedia commented 10 months ago

Still have it in 2.4.6-p2.

theroch commented 5 months ago

Still have it in 2.4.6-p4.

derekBaldwinGG commented 4 months ago

Issue persists in 2.4.6-p3. No patch for this from Adobe Commerce yet?

YiffyToys commented 2 months ago

We just noticed the same, wrong config-entry on a 2.4.7-p1 Magento. We do not use Braintree at all.