I think this has something to do with a bad database table although I'm not sure how I would go about finding out where or how it happened so any advice would be greatly appreciated!

I have seen questions about a similar error on reports but this is whenever I view a contact so I'm not sure how related they are.

This error gets flagged up several times when I go to view any contact:

Notice: unserialize(): Error at offset 247 of 426 bytes in Civi\Core\SettingsBag->loadValues() (line 153 of /home/vabarnsley/public_html/sites/all/modules/civicrm/Civi/Core/SettingsBag.php).

I'm using CiviCRM version 5.13.5 and Drupal 7 on PHP 7.1.

I apologise for being a little vague but I'm hoping it makes more sense to someone that has seen it better or knows how to help.

1 Answer 1


This would happen if you have an invalid value in your civicrm_setting table, if someone tried to manually edit one of the serialized values stored in there.

If you're not sure which value(s) might be problematic in that table, you can try editing the file at `Civi/Core/SettingsBag.php and insert this right after line 153 (note this is untested):

if ($dao->value !== NULL && !unserialize($dao->value)) {
  CRM_Core_Error::debug('bad setting', $dao->name);

That should print the name of the bad setting on your screen.

  • There is a civicrm_setting table but not a civicrm_settings table. I don't know if this would cause any issues? I had a look before posting the question but didn't know what I was looking for. I'll try your suggestion now.
    – Jade
    Jun 5, 2019 at 14:33
  • Yes, sorry, my bad. Fixed. Jun 5, 2019 at 14:34
  • I tried your code on line 154 of the SettingsBag.php file (after the '$this->values[$dao->name] = ($dao->value !== NULL) ? unserialize($dao->value) : NULL;' line) but this just gave me a 'This website encountered an unexpected error' message
    – Jade
    Jun 5, 2019 at 14:44

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.