PHP 8 TypeError I encountered when making adjustments to the search preferences, unchecking not needed fields and checking new custom fields. no autocomplete drop down anymore and when I TRY to go back into search preferences, a fatal 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..

Is this just because of php 8? I am on Drupal 9 and it requires php 8, but will work on 7.4, i thinks.. ? any fixes on the horizon?

2 Answers 2


A roll back to php 7.4 along with deletion of template_c files seems to bring back a working environment. As in, php7.4 does not fatal error on this however the issue persists.. Just tested in Drupal 7 as well and any change with search preferences causes things to break.


I'm guessing this has been a bug for a while, not strictly related to php 8, it just crashes with php 8. Can you file an issue at https://lab.civicrm.org with the stack trace?

By the way drupal 9 will run with php 7.4 and it won't be removed from drupal 9, just drupal 10.

EDIT: Fix is at https://github.com/civicrm/civicrm-core/pull/25170

  • Thanks for that, drupal Fails on the update screens because of php 7.4 . I will open an issue thanks! Commented Dec 3, 2022 at 2:30
  • Ok I see what you mean if you're not already on 9.4 then it gives a warning about 7.4 that looks like a fail but it's just a warning and you can click continue, or use drush.
    – Demerit
    Commented Dec 3, 2022 at 15:22
  • yeah, for sure.. this issue is fatal on php8 and wonky in 7.4. pretty sure I just figured out why. see civicrm.stackexchange.com/q/43074/14046 I will update the Issue as well.. Feeling much better today .. Commented Dec 3, 2022 at 15:39

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.