Drafted by claude
Problem/Motivation
Commerce 3.3.13 removed the constructor from PaymentMethodFormBase. Its create() now calls new static() and sets the services afterwards. On 8.x-1.x, Drupal\commerce_paypal\PluginForm\Checkout\PaymentMethodAddForm still overrides the constructor and calls parent::__construct(), so checkout fails when PayPal's payment method form is built:
Error: Cannot call constructor in Drupal\commerce_paypal\PluginForm\Checkout\PaymentMethodAddForm->__construct() (line 54 of modules/contrib/commerce_paypal/src/PluginForm/Checkout/PaymentMethodAddForm.php).
This was fixed on 2.x in 2.1.2 ("Stop overridding the parent constructor in PaymentMethodAddForm"), but 8.x-1.12 and 8.x-1.x-dev still have the constructor.
Steps to reproduce
- Install Commerce 3.3.13 and Commerce PayPal 8.x-1.12.
- Enable a PayPal Checkout gateway.
- Go to checkout and select PayPal on the Order information step.
Proposed resolution
Backport the 2.1.2 change: remove the constructor and set the two extra services in create() after calling parent::create(). The attached patch does this against 8.x-1.12.
Issue fork commerce_paypal-3634502
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3634502-8.x-1.x
changes, plain diff MR !68
- 3634502-error-cannot-call
compare
Comments
Comment #2
tonytheferg commentedComment #4
tonytheferg commentedWhoops. wrong version.
I don't think 8.x is compatible with the latest version of commerce, so maybe this isn't outdated if that version isn't pinned as a dependency.
Comment #7
tonytheferg commentedComment #8
tonytheferg commentedSorry for the mess. MR by Claude. I moved on to 2.x
Comment #11
jsacksick commentedMade a few additions and merged, thanks! I thought I had already fixed this in the past.