- Issue created by @e.bogatyrev
During the test compatibility with Drupal 11 I discovered an issue with adding payment gateway
- Install the module
- go to /admin/commerce/config/payment-gateways
- try to Add payment gateway
The stack trace is below
ypeError: array_map(): Argument #2 ($array) must be of type array, null given in array_map() (line 303 of modules/contrib/commerce/modules/payment/src/Plugin/Commerce/PaymentGateway/PaymentGatewayBase.php).
Drupal\commerce_payment\Plugin\Commerce\PaymentGateway\PaymentGatewayBase->buildConfigurationForm(Array, Object) (Line: 152)
Drupal\commerce_hyperpay\Plugin\Commerce\PaymentGateway\HyperPayCopyAndPay->buildConfigurationForm(Array, Object) (Line: 105)
Drupal\commerce\Plugin\Commerce\InlineForm\PluginConfiguration->buildInlineForm(Array, Object) (Line: 130)
Drupal\commerce_payment\Form\PaymentGatewayForm->form(Array, Object) (Line: 107)
Drupal\Core\Entity\EntityForm->buildForm(Array, Object) (Line: 66)
Drupal\commerce_payment\Form\PaymentGatewayForm->buildForm(Array, Object)
call_user_func_array(Array, Array) (Line: 528)
Drupal\Core\Form\FormBuilder->retrieveForm('commerce_payment_gateway_add_form', Object) (Line: 279)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 593)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 183)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 53)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 705)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
$payment_method_types = array_map(function ($payment_method_type) {
return $payment_method_type->getLabel();
}, $this->paymentMethodTypes);
here `$this->paymentMethodTypes` is NULL but expect an array.
I uninstalled the `commerce_hyperpay` to make sure there is no issue with commerce module. The commerce itself working as expected. So there is needed a further investigation with `commerce_hyperpay`
Active
2.0
Code