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

  1. Install Commerce 3.3.13 and Commerce PayPal 8.x-1.12.
  2. Enable a PayPal Checkout gateway.
  3. 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.

Command icon 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:

Comments

tonytheferg created an issue. See original summary.

tonytheferg’s picture

Status: Active » Closed (outdated)

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

tonytheferg’s picture

Status: Closed (outdated) » Active

Whoops. 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.

tonytheferg changed the visibility of the branch 3634502-error-cannot-call to hidden.

tonytheferg’s picture

Version: 2.x-dev » 8.x-1.x-dev
tonytheferg’s picture

Status: Active » Needs review

Sorry for the mess. MR by Claude. I moved on to 2.x

jsacksick made their first commit to this issue’s fork.

  • jsacksick committed 4e696935 on 8.x-1.x authored by tonytheferg
    fix: #3634502 Error: Cannot call constructor in Drupal\commerce_paypal\...
jsacksick’s picture

Status: Needs review » Fixed

Made a few additions and merged, thanks! I thought I had already fixed this in the past.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.