I'm running against a fatal error when I attempt to update my user profile on a drupal9/civicrm5.49.5 setup (url path: /user/1/edit/profile/1).

The error message is as follows:

The website encountered an unexpected error. Please try again later.
TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in include() (line 15 of sites/default/files/civicrm/templates_c/en_US/%%4D/4DC/4DC76B26%%body.tpl.php).

include() (Line: 1914)
Smarty->_smarty_include(Array) (Line: 43)
include('/app/web/sites/default/files/civicrm/templates_c/en_US/%%0A/0AF/0AF6F87E%%Dynamic.tpl.php') (Line: 1273)
Smarty->fetch('CRM/Profile/Form/Dynamic.tpl', NULL, NULL, ) (Line: 185)
CRM_Core_Smarty->fetch('CRM/Profile/Form/Dynamic.tpl') (Line: 930)
CRM_Core_BAO_UFGroup::getEditHTML(203, 'Name and Address') (Line: 86)
Drupal\civicrm\Form\UserProfile->buildForm(Array, Object, Object, '1')
call_user_func_array(Array, Array) (Line: 531)
Drupal\Core\Form\FormBuilder->retrieveForm('civicrm_user_profile', Object) (Line: 278)
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: 564)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 158)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 80)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->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: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 708)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

I suspect a problem with PHP 8 support. The problem goes away after downgrading PHP to 7.4. to be more specific, the error is not FATAL on 7.4 and is fatal PHP 8+

Seems related to another PHP 7.4, PHP 8 TypeError I encountered when making adjustments to the search preferences, unchecking not needed fields and checking new custom fields, reordering or any change on the search preferences page. no autocomplete drop down anymore and when I TRY to go back into search preferences, error is thrown with:

The website encountered an unexpected error. Please try again later. TypeError: array_flip(): Argument #1 ($array) must be of type array, string given in array_flip() (line 380 of /code/vendor/civicrm/civicrm-core/CRM/Admin/Form/SettingTrait.php). array_flip('external_identifiersort_namecitycustom_Annuity_Balancecustom_PAP_Balancecustom_Pension_Credits_to_Date') (Line: 380) CRM_Admin_Form_Setting::reorderSortableOptions('quicksearch_options', Array) (Line: 224) CRM_Admin_Form_Setting->addFieldsDefinedInSettingsMetadata() (Line: 66) CRM_Admin_Form_Setting->buildQuickForm() (Line: 47) CRM_Admin_Form_Setting_Search->buildQuickForm() (Line: 689) CRM_Core_Form->buildForm() (Line: 76).... and more..

This is Fatal because of php 8? Not fatal on php 7.4.

This issue is related to CiviCRM 5.55.1 .2 and 5.56

I did create an issue of this and filed as bug.

1 Answer 1


This sounds the same as https://lab.civicrm.org/dev/core/-/issues/2301#note_52815 but it's a bit hard to fix properly because there are multiple problems at once and the validation on that form is not correct to begin with.

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.