1

The following error's are throwing at the top of each personal contact pages. It does not show these errors on an orgs contact page. I would appreciate any feedback.

Thank you!

Erin

detects parameter 1 to be array, null given in /home/connectionsvol/public_html/civicrm/wp-content/plugins/civicrm/civicrm/CRM/Utils/Array.php on line 1037

Warning: array_keys() expects parameter 1 to be array, null given in /home/connectionsvol/public_html/civicrm/wp-content/plugins/civicrm/civicrm/CRM/Utils/Array.php on line 1037

Warning: array_keys() expects parameter 1 to be array, null given in /home/connectionsvol/public_html/civicrm/wp-content/plugins/civicrm/civicrm/CRM/Utils/Array.php on line 1037

Warning: array_keys() expects parameter 1 to be array, null given in /home/connectionsvol/public_html/civicrm/wp-content/plugins/civicrm/civicrm/CRM/Utils/Array.php on line 1037

Warning: array_keys() expects parameter 1 to be array, null given in /home/connectionsvol/public_html/civicrm/wp-content/plugins/civicrm/civicrm/CRM/Utils/Array.php on line 1037

Warning: array_keys() expects parameter 1 to be array, null given in /home/connectionsvol/public_html/civicrm/wp-content/plugins/civicrm/civicrm/CRM/Utils/Array.php on line 1037

Warning: array_keys() expects parameter 1 to be array, null given in /home/connectionsvol/public_html/civicrm/wp-content/plugins/civicrm/civicrm/CRM/Utils/Array.php on line 1037

Warning: array_keys() expects parameter 1 to be array, null given in /home/connectionsvol/public_html/civicrm/wp-content/plugins/civicrm/civicrm/CRM/Utils/Array.php on line 1037

Warning: array_keys() expects parameter 1 to be array, null given in /home/connectionsvol/public_html/civicrm/wp-content/plugins/civicrm/civicrm/CRM/Utils/Array.php on line 1037

Warning: array_keys() expects parameter 1 to be array, null given in /home/connectionsvol/public_html/civicrm/wp-content/plugins/civicrm/civicrm/CRM/Utils/Array.php on line 1037

Warning: Cannot modify header information - headers already sent by (output started at /home/connectionsvol/public_html/civicrm/wp-content/plugins/civicrm/civicrm/CRM/Utils/Array.php:1037) in /home/connectionsvol/public_html/civicrm/wp-includes/option.php on line 820

Warning: Cannot modify header information - headers already sent by (output started at /home/connectionsvol/public_html/civicrm/wp-content/plugins/civicrm/civicrm/CRM/Utils/Array.php:1037) in /home/connectionsvol/public_html/civicrm/wp-includes/option.php on line 821

2

I got this error in Drupal after upgrading 4.6.9 to 4.7.3. Exact text (repeating several times):

Warning: array_keys() expects parameter 1 to be array, null given in CRM_Utils_Array::formatArrayKeys() (line 1037 of /home/mysitename/public_html/sites/all/modules/civicrm/CRM/Utils/Array.php)

I was able to fix one record by editing & saving. But doing that for thousands of records wasn't an option.

So comparing custom fields of fixed records to broken records in phpMyAdmin, I found that the fixed records had blank entries whereas broken records were NULL, and that the number of fields that were checkboxes matched the number of error messages. I disabled my custom field sets and the errors went away.

After disabling my fields, I updated the custom field to set the value to blank where value is null. The SQL was similar to this:

update `civicrm_value_custom_table_1` set `custom_field_123`="" where `custom_field_123` IS NULL;

I repeated that for all problematic fields, enabled my custom fields and all was well.

tl;dr: Cause is NULL values in custom checkbox fields. Fix is to update NULL values to blank values

  • Just a thought, but should a bug report be filed on this? – G H Mar 16 '16 at 20:47
  • I considered that, but I upgraded a few more sites and didn't have the same problem. Seems like it was a fluke. – Eric H Mar 22 '16 at 23:19
0

I got the same error but in my case the custom field had no value at all (no row for this id). Adding isset solves the issue, but not sure whether this is a correct way of working. Can anyone confirm?

public static function formatArrayKeys(&$array) {
++    if (isset($keys)) {
      $keys = array_keys($array, 1);
      if (count($keys) > 1 ||
        (count($keys) == 1 &&
          (current($keys) > 1 ||
            is_string(current($keys)) ||
            (current($keys) == 1 && $array[1] == 1) // handle (0 => 4), (1 => 1)
          )
        )
      ) {
        $array = $keys;
      }
    }
++  }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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