Answers.Body: <p>This was not a bug that caused any loss of functionality, just a php notice which has since been fixed via this patch: <a href="https://github.com/colemanw/webform_civicrm/pull/139" rel="nofollow noreferrer">https://github.com/colemanw/webform_civicrm/pull/139</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-06-04T07:01:55.597Z
Answers.Text: would you mind double-checking?  DRU-2966760 was about a [different PHP notice](https://civicrm.stackexchange.com/questions/24626/webform-with-existing-contact-results-in-undefine-index?noredirect=1#comment27939_24626).  And thanks for patching that!
Answers.UserDisplayName: wil_SRQ
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-06-04T11:29:43.607Z
Answers.Text: I think the pr got linked to the wrong issue but if you look at the code you'll see it fixed the line you pointed to in your question.
Answers.UserDisplayName: Coleman
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-06-02T02:05:06.320Z
Answers.LastActivityDate: 2018-06-02T02:05:06.320Z
Answers.UserDisplayName: Coleman
Body: <p>When creating (or saving) a custom data group or (field)set the following error pops up:</p>
  
  <p>Notice: Undefined offset: 0 in webform_civicrm_civicrm_postSave_civicrm_custom_group() (line 436 of /home/unidosnow/www/www/sites/all/modules/webform_civicrm/webform_civicrm.module)</p>
  
  <p>The code throwing this:</p>
  
  <pre><code>/**
   * Implements hook_civicrm_postSave_tableName().
   *
   * Handles adding/editing a custom group.
   *
   * @param CRM_Core_DAO_CustomGroup $dao
   */
  function webform_civicrm_civicrm_postSave_civicrm_custom_group($dao) {
    module_load_include('inc', 'webform', 'includes/webform.components');
  
    // get all fieldsets with custom group ID
    $customGroupId = $dao-&gt;id;
    $dbResource = db_query("SELECT * FROM {webform_component} WHERE type ='fieldset' "
            . "AND form_key LIKE '%cg{$customGroupId}_fieldset'");
    $fieldsets = $dbResource-&gt;fetchAll(PDO::FETCH_ASSOC);
  
    // check if dao fields have been fetched
    if (!$dao-&gt;title) {
      $dao-&gt;find(TRUE);
    }
  
    // run only if the title of the custom group has changed in civicrm
    --&gt;&gt;  if ($fieldsets[0]['name'] != $dao-&gt;title) {  &lt;&lt;-- Exception here
      foreach ($fieldsets as $field_info) {
        $component = array();
        $component['name'] = $dao-&gt;title;
        $component['type'] = $field_info['type'];
        $component['form_key'] = $field_info['form_key'];
        $component['weight'] = $field_info['weight'];
        $component['nid'] = $field_info['nid'];
        $component['cid'] = $field_info['cid'];
        $component['pid'] = $field_info['pid'];
        webform_component_update($component);
      }
    }
  }
  </code></pre>
  
  <p>The custom set creates successfully, haven't yet tried to use it in a webform.  Before the 4/25 update I had created custom data sets without this error.  Don't have record of the versions I was using at the time, the current versions that show the problem are CiviCRM 4.7.29, Drupal Core 7.59, webform-civicrm 4.20, and webform 4.17.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-05-22T08:00:46.823Z
Comments.Text: Is the webform functional working? Does it update/insert the data you want? If so I would say it is a notice and ignore it. If it doesn't work the notice might be a clue in finding the cause but not neccesarly be the cause.
Comments.UserDisplayName: Jaap Jansma - CiviCooP
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-05-22T14:43:03.017Z
Comments.Text: Finally had a chance to test.  Despite the Notices, the custom CiviCRM fields are exposed and processed correctly by Webform.  I'll ignore the Notices.
Comments.UserDisplayName: wil_SRQ
Tags: <webform-civicrm>
Title: webform-civicrm error when creating CiviCRM custom data group
ThreadText: # webform-civicrm error when creating CiviCRM custom data group
  
  (Asked by: username_0 on 2018-05-22)
  
  When creating (or saving) a custom data group or (field)set the following error pops up:
  
  Notice: Undefined offset: 0 in webform\_civicrm\_civicrm\_postSave\_civicrm\_custom\_group() (line 436 of /home/unidosnow/www/www/sites/all/modules/webform\_civicrm/webform\_civicrm.module)
  
  The code throwing this:
  
  ```
  /**
   * Implements hook_civicrm_postSave_tableName().
   *
   * Handles adding/editing a custom group.
   *
   * @param CRM_Core_DAO_CustomGroup $dao
   */
  function webform_civicrm_civicrm_postSave_civicrm_custom_group($dao) {
    module_load_include('inc', 'webform', 'includes/webform.components');
  
    // get all fieldsets with custom group ID
    $customGroupId = $dao->id;
    $dbResource = db_query("SELECT * FROM {webform_component} WHERE type ='fieldset' "
            . "AND form_key LIKE '%cg{$customGroupId}_fieldset'");
    $fieldsets = $dbResource->fetchAll(PDO::FETCH_ASSOC);
  
    // check if dao fields have been fetched
    if (!$dao->title) {
      $dao->find(TRUE);
    }
  
    // run only if the title of the custom group has changed in civicrm
    -->>  if ($fieldsets[0]['name'] != $dao->title) {  <<-- Exception here
      foreach ($fieldsets as $field_info) {
        $component = array();
        $component['name'] = $dao->title;
        $component['type'] = $field_info['type'];
        $component['form_key'] = $field_info['form_key'];
        $component['weight'] = $field_info['weight'];
        $component['nid'] = $field_info['nid'];
        $component['cid'] = $field_info['cid'];
        $component['pid'] = $field_info['pid'];
        webform_component_update($component);
      }
    }
  }
  
  ```
  
  The custom set creates successfully, haven't yet tried to use it in a webform. Before the 4/25 update I had created custom data sets without this error. Don't have record of the versions I was using at the time, the current versions that show the problem are CiviCRM 4.7.29, Drupal Core 7.59, webform-civicrm 4.20, and webform 4.17.
  
  **Tags:** webform-civicrm
  
  > **Comments:**
  > **username_1**: Is the webform functional working? Does it update/insert the data you want? If so I would say it is a notice and ignore it. If it doesn't work the notice might be a clue in finding the cause but not neccesarly be the cause.  
  > **username_0**: Finally had a chance to test.  Despite the Notices, the custom CiviCRM fields are exposed and processed correctly by Webform.  I'll ignore the Notices.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2018-06-02. Score: 2
  
  This was not a bug that caused any loss of functionality, just a php notice which has since been fixed via this patch: <https://github.com/colemanw/webform_civicrm/pull/139>
  
  > **Comments:**
  > **username_0**: would you mind double-checking?  DRU-2966760 was about a [different PHP notice](https://civicrm.stackexchange.com/questions/24626/webform-with-existing-contact-results-in-undefine-index?noredirect=1#comment27939_24626).  And thanks for patching that!  
  > **username_2**: I think the pr got linked to the wrong issue but if you look at the code you'll see it fixed the line you pointed to in your question.  
  
  ---
  
  