Answers.Body: <p>This is a JIRA ticket <a href="https://issues.civicrm.org/jira/browse/CRM-18504" rel="nofollow">here</a> which references a patch that others have said has fixed things. I just tried cherrypicking the changes over and then run drush cc but still seeing same errors. </p>
  
  <p>clearly relates in my case to a contact_sub_type that looks like it had its name changed (in contact_type I am seeing label = Funder. and name=Funder_ but in custom_group it is just referred to as Funder)</p>
  
  <p>I did try changing the contact_type name from Funder_ to Funder but no joy</p>
  
  <p>EDIT: actually i think renaming did succeed, as i then reversed the patch out, for the sake of something else to try, but same error on drush cc - and then on a whim visited civicrm/upgrade, and while that page told me "Your database has already been upgraded to CiviCRM 4.6.16.0" it did the job, and the resolved alerts flooded on to the phone etc.</p>
  
  <p>Hope that gives you some clues.</p>
  
  <p>Also, in case it has any relevance, the sub-type that caused the problem had "CiviEngage - Funder" in the description, so wondering if the misnamed type came as part of that? Maybe worth checking.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-07T01:24:41.967Z
Answers.Text: No joy for me, or not much. I tried the patch (or really replaced CustomGroup.php with https://raw.githubusercontent.com/JKingsnorth/civicrm-core/CRM-18504/CRM/Core/BAO/CustomGroup.php ) and with just civicrm enabled, things seemed to work. As soon as I enabled any other related modules, the entire site was back on error. To fix I had to disable civicrm entirely.
Answers.UserDisplayName: TimETown
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-07T01:27:12.687Z
Answers.Text: Tried editing `civicrm_custom_group`.`extends_entity_column_value` value that seemed wrong, which in my case was Orchestra_MemberMusician instead of Orchestra_Member. Did not fix it with or without the patch.
Answers.UserDisplayName: TimETown
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-07T01:30:25.123Z
Answers.Text: Rolled back the patch and even after the edited value in the civicrm_custom_group table, site immediately errors out.
Answers.UserDisplayName: TimETown
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-07T04:05:40.900Z
Answers.Text: I have found another site which hit similar problems
Answers.UserDisplayName: petednz - fuzion
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-07T04:05:49.383Z
Answers.Text: what i see in DB is that contact_type has name = Media_Outlet and label of Media Outlet - and in custom_group it is Media_Outlet
Answers.UserDisplayName: petednz - fuzion
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-07T04:06:20.307Z
Answers.Text: and i have this in logs (not sure how 'comment' will treat formatting:
Answers.UserDisplayName: petednz - fuzion
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-07T04:06:29.620Z
Answers.Text: I have this in logs
  
    'is_error' => 0,
    'version' => 3,
    'count' => 1,
    'id' => 'Media_Outlet',
    'values' => 
    array (
      'Media_Outlet' => 'Media Outlet',
    ),
  )
Answers.UserDisplayName: petednz - fuzion
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-08T14:35:45.213Z
Answers.Text: I patched with Chris Burgess added a comment - Yesterday 7:50 AM
  In 4.6 I've used these changes to address same issue:
  https://github.com/fuzionnz/civicrm-core/commit/a0bcc16171d2f30c4416aeec079bab56c313390a
  https://github.com/fuzionnz/civicrm-core/commit/d3e9ab21a0f2256197125854fe6312c3fa0c8c8a
Answers.UserDisplayName: TimETown
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-08T14:37:47.027Z
Answers.Text: And this did make my site functional, it seems. However 1) I had to undo the "fix" the the custom_group table for the Orchestra_MemberMusician entry or the custom group was missing in individual records. HOWEVER, reports are now unable to pull anything from that field, so I'm not sure how fixed or broken things really are.
Answers.UserDisplayName: TimETown
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-08T14:39:38.387Z
Answers.Text: also, drush now reports this error once civcrmentity is enabled: Invalid argument supplied for foreach() common.inc:7177                                       [warning]
  array_keys() expects parameter 1 to be array, null given common.inc:7197
Answers.UserDisplayName: TimETown
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-06T14:20:23.903Z
Answers.LastActivityDate: 2016-05-06T14:46:34.260Z
Answers.LastEditDate: 2016-05-06T14:46:34.260Z
Answers.UserDisplayName: petednz - fuzion
Answers.Body: <p>The patches in Jira did not fix the problem for me, I was upgrading from 4.6.16 to 4.6.20.</p>
  
  <p>I was able to fix this problem by changing the CustomGroup.php file to output the <code>$subType</code> and <code>$subType</code> the error is about in the error output and then setting those values to to <code>NULL</code> in the custom_group table's <code>extends_entity_column_value</code> column for each error.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-08-23T04:24:18.480Z
Answers.LastActivityDate: 2016-08-23T19:42:00.257Z
Answers.LastEditDate: 2016-08-23T19:42:00.257Z
Answers.UserDisplayName: DrCord
Answers.Body: <p>The patch described on JIRA ticket <a href="https://issues.civicrm.org/jira/browse/CRM-18504" rel="nofollow">CRM-18504</a> resolved the problem for me on 4.7.7 </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-08T19:02:06.853Z
Answers.LastActivityDate: 2016-05-09T14:43:51.583Z
Answers.LastEditDate: 2016-05-09T14:43:51.583Z
Answers.UserDisplayName: olivier
Body: <p>The upgrade from 4.6.10 to 4.6.16 ran and pronounced itself successful, but after re-enabling the modules The site reports an error which shows via Drush as:</p>
  
  <p>WD menu: CRM_Core_Exception: Invalid Filter in CRM_Core_BAO_CustomGroup::validateSubTypeByEntity() (line [error]
  647 of MYSITE/public_html/sites/all/modules/civicrm/CRM/Core/BAO/CustomGroup.php).</p>
  
  <p>Running cron or clearing cache does nothing to help.</p>
  
  <p>I did a compare of the backup files to those in the modules/civicrm direcotry and found one new file (Civi.php) and few other differences</p>
  
  <p>diff /drupalbackups/civicrm4.6.pre16/civicrm-version.php /public_html/sites/all/modules/civicrm/civicrm-version.php
  3c3</p>
  
  <h2>&lt;   return array( 'version'  => '4.6.10',</h2>
  
  <blockquote>
    <p>return array( 'version'  => '4.6.16',
    5c5</p>
    
    <h2>&lt;                 'revision' => '3a0725b2d0' );</h2>
  
  <pre><code>            'revision' =&gt; 'dcf53fa10e' );
  </code></pre>
    
    <p>Only in /public_html/sites/all/modules/civicrm: Civi.php
    diff /drupalbackups/civicrm4.6.pre16/composer.json /public_html/sites/all/modules/civicrm/composer.json
    4a5 .... QUITE A FEW CHANGES IN THIS FILE
    diff /drupalbackups/civicrm4.6.pre16/composer.lock /public_html/sites/all/modules/civicrm/composer.lock
    7c7,8  .... QUITE A FEW CHANGES IN THIS FILE</p>
  </blockquote>
  
  <p>Only in /drupalbackups/civicrm4.6.pre16: .htaccess
  (I placed that to control against timeouts)</p>
  
Tags: <upgrade><php>
Title: Upgrade to 4.6.16+ caused site to fail with error
ThreadText: # Upgrade to 4.6.16+ caused site to fail with error
  
  (Asked by: username_0 on 2016-05-05)
  
  The upgrade from 4.6.10 to 4.6.16 ran and pronounced itself successful, but after re-enabling the modules The site reports an error which shows via Drush as:
  
  WD menu: CRM\_Core\_Exception: Invalid Filter in CRM\_Core\_BAO\_CustomGroup::validateSubTypeByEntity() (line [error]
  647 of MYSITE/public\_html/sites/all/modules/civicrm/CRM/Core/BAO/CustomGroup.php).
  
  Running cron or clearing cache does nothing to help.
  
  I did a compare of the backup files to those in the modules/civicrm direcotry and found one new file (Civi.php) and few other differences
  
  diff /drupalbackups/civicrm4.6.pre16/civicrm-version.php /public\_html/sites/all/modules/civicrm/civicrm-version.php
  3c3
  
  ## < return array( 'version' => '4.6.10',
  
  > return array( 'version' => '4.6.16',
  > 5c5
  >
  > ## < 'revision' => '3a0725b2d0' );
  >
  > ```
  >             'revision' => 'dcf53fa10e' );
  >
  > ```
  >
  > Only in /public\_html/sites/all/modules/civicrm: Civi.php
  > diff /drupalbackups/civicrm4.6.pre16/composer.json /public\_html/sites/all/modules/civicrm/composer.json
  > 4a5 .... QUITE A FEW CHANGES IN THIS FILE
  > diff /drupalbackups/civicrm4.6.pre16/composer.lock /public\_html/sites/all/modules/civicrm/composer.lock
  > 7c7,8 .... QUITE A FEW CHANGES IN THIS FILE
  
  Only in /drupalbackups/civicrm4.6.pre16: .htaccess
  (I placed that to control against timeouts)
  
  **Tags:** upgrade, php
  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_1 on 2016-05-06. Score: 2
  
  This is a JIRA ticket [here](https://issues.civicrm.org/jira/browse/CRM-18504) which references a patch that others have said has fixed things. I just tried cherrypicking the changes over and then run drush cc but still seeing same errors.
  
  clearly relates in my case to a contact\_sub\_type that looks like it had its name changed (in contact\_type I am seeing label = Funder. and name=Funder\_ but in custom\_group it is just referred to as Funder)
  
  I did try changing the contact\_type name from Funder\_ to Funder but no joy
  
  EDIT: actually i think renaming did succeed, as i then reversed the patch out, for the sake of something else to try, but same error on drush cc - and then on a whim visited civicrm/upgrade, and while that page told me "Your database has already been upgraded to CiviCRM 4.6.16.0" it did the job, and the resolved alerts flooded on to the phone etc.
  
  Hope that gives you some clues.
  
  Also, in case it has any relevance, the sub-type that caused the problem had "CiviEngage - Funder" in the description, so wondering if the misnamed type came as part of that? Maybe worth checking.
  
  > **Comments:**
  > **username_0**: No joy for me, or not much. I tried the patch (or really replaced CustomGroup.php with https://raw.githubusercontent.com/JKingsnorth/civicrm-core/CRM-18504/CRM/Core/BAO/CustomGroup.php ) and with just civicrm enabled, things seemed to work. As soon as I enabled any other related modules, the entire site was back on error. To fix I had to disable civicrm entirely.  
  > **username_0**: Tried editing `civicrm_custom_group`.`extends_entity_column_value` value that seemed wrong, which in my case was Orchestra_MemberMusician instead of Orchestra_Member. Did not fix it with or without the patch.  
  > **username_0**: Rolled back the patch and even after the edited value in the civicrm_custom_group table, site immediately errors out.  
  > **username_1**: I have found another site which hit similar problems  
  > **username_1**: what i see in DB is that contact_type has name = Media_Outlet and label of Media Outlet - and in custom_group it is Media_Outlet  
  > **username_1**: and i have this in logs (not sure how 'comment' will treat formatting:  
  > **username_1**: I have this in logs    'is_error' => 0,   'version' => 3,   'count' => 1,   'id' => 'Media_Outlet',   'values' =>    array (     'Media_Outlet' => 'Media Outlet',   ), )  
  > **username_0**: I patched with Chris Burgess added a comment - Yesterday 7:50 AM In 4.6 I've used these changes to address same issue: https://github.com/fuzionnz/civicrm-core/commit/a0bcc16171d2f30c4416aeec079bab56c313390a https://github.com/fuzionnz/civicrm-core/commit/d3e9ab21a0f2256197125854fe6312c3fa0c8c8a  
  > **username_0**: And this did make my site functional, it seems. However 1) I had to undo the "fix" the the custom_group table for the Orchestra_MemberMusician entry or the custom group was missing in individual records. HOWEVER, reports are now unable to pull anything from that field, so I'm not sure how fixed or broken things really are.  
  > **username_0**: also, drush now reports this error once civcrmentity is enabled: Invalid argument supplied for foreach() common.inc:7177                                       [warning] array_keys() expects parameter 1 to be array, null given common.inc:7197  
  
  ---
  
  ### Answer by username_2 on 2016-08-23. Score: 1
  
  The patches in Jira did not fix the problem for me, I was upgrading from 4.6.16 to 4.6.20.
  
  I was able to fix this problem by changing the CustomGroup.php file to output the `$subType` and `$subType` the error is about in the error output and then setting those values to to `NULL` in the custom\_group table's `extends_entity_column_value` column for each error.
  
  
  ---
  
  ### Answer by username_3 on 2016-05-08. Score: 0
  
  The patch described on JIRA ticket [CRM-18504](https://issues.civicrm.org/jira/browse/CRM-18504) resolved the problem for me on 4.7.7
  
  
  ---
  
  