1

I'm setting up a membership form using a contribution page. I've installed the "Omnipay multiprocessor support" and have it set up for sandbox payments. When I complete the process and I'm returned to the site, I get a critical error page.

The php error logs show the following error:

[25-Aug-2023 19:51:19 Australia/Brisbane] PHP Fatal error:  Uncaught TypeError: array_merge(): Argument #2 must be of type array, null given in /home/xxx/public_html/wp-content/plugins/civicrm/civicrm/CRM/Contribute/Form/Contribution/Confirm.php:294
Stack trace:
#0 /home/xxx/public_html/wp-content/plugins/civicrm/civicrm/CRM/Contribute/Form/Contribution/Confirm.php(294): array_merge(Array, NULL)
#1 /home/xxx/public_html/wp-content/plugins/civicrm/civicrm/CRM/Contribute/Form/Contribution/Main.php(1345): CRM_Contribute_Form_Contribution_Confirm->preProcess()
#2 /home/xxx/public_html/wp-content/plugins/civicrm/civicrm/CRM/Contribute/Form/Contribution/Main.php(1102): CRM_Contribute_Form_Contribution_Main->skipToThankYouPage()
#3 /home/xxx/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Form.php(617): CRM_Contribute_Form_Contribution_Main->postProcess()
#4 /home/xxx/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/QuickForm/Action/Upload.php(153): CRM_Core_Form->mainProcess()
#5 /home/xxx/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/QuickForm/Action/Upload.php(120): CRM_Core_QuickForm_Action_Upload->realPerform(Object(CRM_Contribute_Form_Contribution_Main), 'upload')
#6 /home/xxx/public_html/wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Upload->perform(Object(CRM_Contribute_Form_Contribution_Main), 'upload')
#7 /home/xxx/public_html/wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Contribute_Form_Contribution_Main), 'upload')
#8 /home/xxx/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php(355): HTML_QuickForm_Page->handle('upload')
#9 /home/xxx/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(319): CRM_Core_Controller->run(Array, NULL)
#10 /home/xxx/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(69): CRM_Core_Invoke::runItem(Array)
#11 /home/xxx/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(36): CRM_Core_Invoke::_invoke(Array)
#12 /home/xxx/public_html/wp-content/plugins/civicrm/civicrm.php(1199): CRM_Core_Invoke::invoke(Array)
#13 /home/xxx/public_html/wp-content/plugins/civicrm/includes/civicrm.basepage.php(380): CiviCRM_For_WordPress->invoke()
#14 /home/xxx/public_html/wp-includes/class-wp-hook.php(310): CiviCRM_For_WordPress_Basepage->basepage_handler(Object(WP))
#15 /home/xxx/public_html/wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters(NULL, Array)
#16 /home/xxx/public_html/wp-includes/plugin.php(565): WP_Hook->do_action(Array)
#17 /home/xxx/public_html/wp-includes/class-wp.php(796): do_action_ref_array('wp', Array)
#18 /home/xxx/public_html/wp-includes/functions.php(1335): WP->main('')
#19 /home/xxx/public_html/wp-blog-header.php(16): wp()
#20 /home/xxx/public_html/index.php(17): require('/home/xxx/pub...')
#21 {main}
  thrown in /home/xxx/public_html/wp-content/plugins/civicrm/civicrm/CRM/Contribute/Form/Contribution/Confirm.php on line 294

This is the first time I've tried to set up civicrm, so I'm a little lost on this one.

Edit: running Civicrm 5.64.1

2
  • Please post your CiviCRM version? Also, if you have the option to run PHP 7, that's a quick way to work around this, TypeErrors aren't fatal in PHP < 8. Commented Aug 25, 2023 at 20:26
  • I've added that I'm using 5.64.1. I tried to downgrade to v7.4 but I get new errors, so have switched back for now. Commented Aug 26, 2023 at 3:53

2 Answers 2

0

The line in question (line 294 of <civiroot>/CRM/Contribute/Form/Contribution/Confirm.php looks like this:

$this->_params = array_merge($this->_params, $preApprovalParams);

You can fix this error by changing it to this:

$this->_params = array_merge($this->_params, $preApprovalParams ?? []);

Now this isn't an ideal solution, because that won't survive a Civi upgrade. The root problem appears to be in the OmniPay extension, in the doPreApproval function.

I don't use OmniPay so can't check myself - but looking at that function, it seems like the only way it wouldn't return a value would be if an error occurred, and that would be in your CiviCRM logs. See if your log files show any errors that have a matching timestamp?

0

Is there a reason you're using Omnipay rather than the inbuilt Paypal processor? (I think I read on Mastodon you saying you were just wanting to integrate Paypal?)

1
  • The reason is that I want to be able to use PayPal Checkout so that people can use a credit card without a Paypal account. As far as I can tell, that isn't possible with the inbuild processor. Commented Sep 13, 2023 at 4:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.