justinbeaty / module-gene-braintree

OpenMage compatible fork of Gene_Braintree module
7 stars 5 forks source link

Fix incorrect variable value #5

Closed ProxiBlue closed 1 year ago

ProxiBlue commented 1 year ago

$return is supposed to be initialised as an array

With this issue in place, the form is not rendered in checkout, and loading spinner stays active

image

Fatal error: Uncaught Error: [] operator not supported for strings in /vagrant/sites/ntotank/app/code/community/Gene/Braintree/Block/Js.php:298
Stack trace:
#0 /vagrant/sites/ntotank/app/design/frontend/base/default/template/gene/braintree/js/setup.phtml(54): Gene_Braintree_Block_Js->getFunding()
https://github.com/uptactics/ntotank/pull/1 /vagrant/sites/ntotank/app/code/core/Mage/Core/Block/Template.php(263): include('/vagrant/sites/...')
https://github.com/uptactics/ntotank/pull/2 /vagrant/sites/ntotank/app/code/core/Mage/Core/Block/Template.php(294): Mage_Core_Block_Template->fetchView()
https://github.com/uptactics/ntotank/pull/3 /vagrant/sites/ntotank/app/code/core/Mage/Core/Block/Template.php(308): Mage_Core_Block_Template->renderView()
https://github.com/uptactics/ntotank/pull/4 /vagrant/sites/ntotank/app/code/community/Gene/Braintree/Block/Assets.php(235): Mage_Core_Block_Template->_toHtml()
https://github.com/uptactics/ntotank/pull/5 /vagrant/sites/ntotank/app/code/community/Gene/Braintree/Block/Js.php(253): Gene_Braintree_Block_Assets->_toHtml()
https://github.com/uptactics/ntotank/pull/6 /vagrant/sites/ntotank/app/code/core/Mage/Core/Block/Abstract.php(938): Gene_Braintree_Block_Js->_toHtml()
https://github.com/uptactics/ntotank/pull/7 /vagrant/sites/ntotank/app/code/core/Mage/Core/Block/Text in /vagrant/sites/ntotank/app/code/community/Gene/Braintree/Block/Js.php on line 298
justinbeaty commented 1 year ago

Hi @ProxiBlue -- Thanks for the contribution. Interesting that nobody came across this issue before.

ProxiBlue commented 1 year ago

For sure, I have no idea why the site I am on is triggering it. OpenMage 20.x, might be some diff in flow to vanilla m1

ProxiBlue commented 1 year ago

Also possible PHP 8.1, not as forgiving

justinbeaty commented 1 year ago

It looks like it's a fatal error since PHP 7.1. In my store I'm using a custom checkout flow, which is why I haven't encountered it. Maybe no one has just used default checkout + PHP 7.1 or higher yet.