A contribution "Pay Later" option results in PHP Fatal error: Uncaught TypeError: array_key_exists() ..BAO/ContributionSoft.php:506
Overview
WSOD on Contribution page ( confirmed on https://wpmaster.demo.civicrm.org/contribution-page/ ) if "Pay Later" enabled - possible it is a combination of options though, see below the form configuration
Form Configuration
"Amounts" tab:
- "Contribution Amounts" enabled 2 "Pay later option" enabled
- No "Price set", fixed contribution options
- "Allow other amounts" enabled with the "Minimum Amount" set as 0
"Membership" tab
- "General" membership type selected, default
- Require Membership Signup enabled
- Separate Membership Payment enabled
- Display Membership Fee enabled
Current behaviour
PHP error log ( from the other server, obviously, since we have no access to wpmaster.demo.civicrm.org internals ):
PHP Fatal error: Uncaught TypeError: array_key_exists(): Argument #2 ($array) must be of type array, null given in /wp-content/plugins/civicrm/civicrm/CRM/Contribute/BAO/ContributionSoft.php:506
Stack trace:
#0 /wp-content/plugins/civicrm/civicrm/CRM/Contribute/BAO/ContributionPage.php(327): CRM_Contribute_BAO_ContributionSoft::formatHonoreeProfileFields(Object(CRM_Core_Smarty), NULL, NULL)
#1 /wp-content/plugins/civicrm/civicrm/CRM/Contribute/Form/Contribution/Confirm.php(1717): CRM_Contribute_BAO_ContributionPage::sendMail(30350, Array, false, false, Array)
#2 /wp-content/plugins/civicrm/civicrm/CRM/Contribute/Form/Contribution/Confirm.php(1403): CRM_Contribute_Form_Contribution_Confirm->postProcessMembership(Array, 30350, Array, Array, Array, Array, true, NULL, false, '2', Array)
#3 /wp-content/plugins/civicrm/civicrm/CRM/Contribute/Form/Contribution/Confirm.php(2489): CRM_Contribute_Form_Contribution_Confirm->processMembership(Array, 30350, Array, Array, Array)
#4 /wp-content/plugins/civicrm/civicrm/CRM/Contribute/Form/Contribution/Confirm.php(2294): CRM_Contribute_Form_Contribution_Confirm->doMembershipProcessing(30350, Array, Array, Array)
#5 /wp-content/plugins/civicrm/civicrm/CRM/Contribute/Form/Contribution/Confirm.php(817): CRM_Contribute_Form_Contribution_Confirm->processFormSubmission(30350)
#6 /wp-content/plugins/civicrm/civicrm/CRM/Core/Form.php(622): CRM_Contribute_Form_Contribution_Confirm->postProcess()
#7 /wp-content/plugins/civicrm/civicrm/CRM/Contribute/Form/Contribution/Main.php(1430): CRM_Core_Form->mainProcess()
#8 /wp-content/plugins/civicrm/civicrm/CRM/Contribute/Form/Contribution/Main.php(1188): CRM_Contribute_Form_Contribution_Main->skipToThankYouPage()
#9 /wp-content/plugins/civicrm/civicrm/CRM/Core/Form.php(622): CRM_Contribute_Form_Contribution_Main->postProcess()
#10 /wp-content/plugins/civicrm/civicrm/CRM/Core/QuickForm/Action/Upload.php(153): CRM_Core_Form->mainProcess()
#11 /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')
#12 /wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Upload->perform(Object(CRM_Contribute_Form_Contribution_Main), 'upload')
#13 /wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Contribute_Form_Contribution_Main), 'upload')
#14 /wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php(355): HTML_QuickForm_Page->handle('upload')
#15 /wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(322): CRM_Core_Controller->run(Array, NULL)
#16 /wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(69): CRM_Core_Invoke::runItem(Array)
#17 /wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(36): CRM_Core_Invoke::_invoke(Array)
#18 /wp-content/plugins/civicrm/civicrm.php(1199): CRM_Core_Invoke::invoke(Array)
Environment information
- CiviCRM: 5.68.0, CiviCRM 5.70.alpha1 (via https://wpmaster.demo.civicrm.org)
- PHP version 8.1.26
- CMS:WordPress 6.4.2
Comments
Line 506 of /wp-content/plugins/civicrm/civicrm/CRM/Contribute/BAO/ContributionSoft.php:506 reads:
switch ($profileContactType) {
case 'Individual':
/* 506 -> */ if (array_key_exists('prefix_id', $params)) {
$honorName = CRM_Utils_Array::value($params['prefix_id'],
so it looks like $params are NULL at this point. Should they be or we just add if(!empty($params here and let it go?