Answers.Body: <p>This would happen if you have an invalid value in your <code>civicrm_setting</code> table, if someone tried to manually edit one of the serialized values stored in there.</p>
  
  <p>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):</p>
  
  
  
  <pre><code>if ($dao-&gt;value !== NULL &amp;&amp; !unserialize($dao-&gt;value)) {
    CRM_Core_Error::debug('bad setting', $dao-&gt;name);
  }
  </code></pre>
  
  <p>That should print the name of the bad setting on your screen.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-05T14:33:16.090Z
Answers.Text: 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.
Answers.UserDisplayName: Jade
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-05T14:34:27.437Z
Answers.Text: Yes, sorry, my bad.  Fixed.
Answers.UserDisplayName: Jon G - Megaphone Tech
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-05T14:44:26.113Z
Answers.Text: 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
Answers.UserDisplayName: Jade
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-05T14:31:28.493Z
Answers.LastActivityDate: 2019-06-05T14:34:20.500Z
Answers.LastEditDate: 2019-06-05T14:34:20.500Z
Answers.UserDisplayName: Jon G - Megaphone Tech
Body: <p>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!</p>
  
  <p>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.</p>
  
  <p>This error gets flagged up several times when I go to view any contact: </p>
  
  <pre><code>Notice: unserialize(): Error at offset 247 of 426 bytes in Civi\Core\SettingsBag-&gt;loadValues() (line 153 of /home/vabarnsley/public_html/sites/all/modules/civicrm/Civi/Core/SettingsBag.php).
  </code></pre>
  
  <p>I'm using CiviCRM version 5.13.5 and Drupal 7 on PHP 7.1.</p>
  
  <p>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.</p>
  
Tags: <drupal><contacts><error>
Title: Unserialize error when viewing a contact
ThreadText: # Unserialize error when viewing a contact
  
  (Asked by: username_0 on 2019-06-05)
  
  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.
  
  **Tags:** drupal, contacts, error
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-06-05. Score: 0
  
  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.
  
  > **Comments:**
  > **username_0**: 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.  
  > **username_1**: Yes, sorry, my bad.  Fixed.  
  > **username_0**: 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  
  
  ---
  
  