When I try to add an offline contribution the soft credits portion of the screen shows a PHP Warning rather than the fields for the soft credit. soft credits forms section only shows PHP warning

The warning is

Warning: Undefined array key "siteHasPCPs" in /var/www/private_fs/civicrm/templates_c/en_US/%%6F/6F7/6F7BB438%%Contribution.tpl.php on line 378

The only solution I have found is changing line 378.

The line I have is <?php if ($this->_tpl_vars['siteHasPCPs'] && ! $this->_tpl_vars['payNow']): ?>

If I add ?? NULL after $this->_tpl_vars['siteHasPCPs'] the line becomes <?php if ($this->_tpl_vars['siteHasPCPs'] ?? NULL && ! $this->_tpl_vars['payNow']): ?>

This change makes the form load as expected. CiviCRM Soft Credit section loading as expected

Before making changes to the code I tried flushing the caches and deletting the templates so that CiviCRM can regenerate them. For each of these attempts I get no change to the issue.

I am running CiviCRM 5.59.3 with Drupal 9.5.5.

I think this was happening before the upgrade but I cannot be positive. I Googled with some different terms this morning and found an issue related to this on the CiviCRM GitLab instance. https://lab.civicrm.org/dev/core/-/issues/4006#register-pane

If I get an answer there I will update this question.


1 Answer 1


This fix on GitLab solves the problem for this specific file. I found other places that this is happening and I will need to work on those on their own.

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.