Immediatly after running the update.php script, I went to the URL 'admin/settings/ldap/ldapgroups/edit/1' and got the following error. (In BETA2, I was using 'memberOf' in the 'Group by attribute' property on that page.)
warning: implode() [function.implode]: Invalid arguments passed in ldap_integration/ldapgroups.admin.inc on line 123.

    $form['group_attr']['ldapgroups_attr'] = array(
      '#type' => 'textarea',
      '#title' => t('Attribute names (one per line)'),
      '#default_value' => implode("\n", ($edit['ldapgroups_attr'] ? unserialize($edit['ldapgroups_attr']) : array())),
      '#cols' => 50,
      '#rows' => 6,
      '#description' => t('If the groups are stored in the user entries, along with the rest of their data, then enter here a list of attributes which may contain them.'),
    );

LINE 123:
'#default_value' => implode("\n", ($edit['ldapgroups_attr'] ? unserialize($edit['ldapgroups_attr']) : array())),

At that point $edit['ldapgroups_attr'] is a string 'memberOf' not and array. So unserialize() makes it NULL, and NULL is not an Array() so PHP spits out that error.
Perhaps we need to add a step to the upgrade process to convert the variable from a string to an array.

Comments

markDrupal’s picture

Here is a screen shot of my database ldapauth table, you can see that even after running the update.php scripts (first picture) the attribute is saved as a string. Then When I type out 'memberOf' and click save on the form the attribute is resaved to the database as a serialized array.(second photo)

markDrupal’s picture

Status: Active » Needs review
StatusFileSize
new979 bytes

I wrote an upgrade function that fixes it for me.


function ldapgroups_update_6002() {
  $ret = array();
  $result = db_query("SELECT ldapgroups_attr, sid FROM {ldapauth} WHERE ldapgroups_attr <> ''");
  $update_count = 0;
  while($data = db_fetch_object($result)){
    if(!is_array(unserialize($data->ldapgroups_attr))){
      $attrs = serialize(explode("\n", $data->ldapgroups_attr));
      db_query("UPDATE {ldapauth} SET ldapgroups_attr = '%s' WHERE sid = %d", $attrs, $data->sid);
      $update_count++;
    }
  }
  if($update_count){

  $ret[] = array('success' => TRUE, 'query' => t("Updated 'Group by attribute' settings for %count %server", array('%count' => $update_count, '%server' => format_plural($update_count, 'server', 'servers'))));
  }
  return $ret;
}
johnbarclay’s picture

Status: Needs review » Closed (won't fix)