I just updated from 7.x-1.0-beta1 to 7.x-1.0-beta2.
During the update.php process, I got the following messages:

    * Notice: Undefined property: stdClass::$type in _ctools_export_unpack_object() (line 775 of /var/www/html/sites/all/modules/ctools/includes/export.inc).
    * Notice: Undefined property: stdClass::$bind_method in _ctools_export_unpack_object() (line 775 of /var/www/html/sites/all/modules/ctools/includes/export.inc).
    * Notice: Undefined property: stdClass::$user_dn_expression in _ctools_export_unpack_object() (line 775 of /var/www/html/sites/all/modules/ctools/includes/export.inc).

When I visit the login page, I get these messages:

    *  Notice: Undefined property: stdClass::$bind_method in _ctools_export_unpack_object() (line 775 of /var/www/html/sites/all/modules/ctools/includes/export.inc).
    * Notice: Undefined property: stdClass::$user_dn_expression in _ctools_export_unpack_object() (line 775 of /var/www/html/sites/all/modules/ctools/includes/export.inc).

I am using ctools: 7.x-1.x-dev (2011-Jun-23)

Comments

alphasupremicus’s picture

Me too! Same issue!

johnbarclay’s picture

I'll look into this. Does it work afterwards or is this only a problem during the update? And are the following changes made to the database:

servers:
db_change_field('ldap_servers', 'type', 'ldap_type', array(
'type' => 'varchar',
'length' => 20,
'not null' => FALSE
));

authorization:
if (!db_field_exists('ldap_authorization', 'create_consumers')) {
db_add_field('ldap_authorization', 'create_consumers', array(
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
));
return t('"create_consumers" field added to ldap_authorization table');
}

alphasupremicus’s picture

The error:
Notice: Undefined property: stdClass::$type in _ctools_export_unpack_object() (line 775 of /u01/html/drupal-7.4/sites/all/modules/ctools/includes/export.inc).
always shows up on the site when I'm not logged in. It wasn't getting an error when running update.php because I use drush so maybe I didn't see the error then, but for me, this error is always present when logged out (on every page). As soon as I logon, it goes away.

As for the field changes you listed above, in my PostgreSQL 9.0.4 back-end database that runs my site, these fields match the new definition you listed above in #2.

I'm running CTools 7.x-1.x-dev dated 2011-Jun-23.
I'm running LDAP 7.x-1.0-beta2.
Also, I'm on Drupal 7.4 (latest release).

thekevinday’s picture

This continues to happen after the update.php.
I can confirm that the mentioned columns have been successfully added to the database.
I also am using postgresql, but with an 8.4.* version.

johnbarclay’s picture

these errors are both from the ldap_servers table/ldap server object.

If you stick the code

function ctools_export_get_schema($table) {
  $cache = &drupal_static(__FUNCTION__);
  if (empty($cache[$table])) {
    $schema = drupal_get_schema($table);
    print "<pre>"; print_r($schema); die;

around line 920 of ctools/inlcudes/export.inc does it show bind_method and user_dn_expression in the fields part of the array?

Does ldap_servers.install have those two fields in the function ldap_servers_schema() ?

All I can suggest is uninstalling ldap_servers and flushing the cache and installing ldap_servers again.

alphasupremicus’s picture

Not sure I can decipher the issue here, but here's the output from the print_r($schema) debug statement I put into export.inc:


Array
(
    [export] => Array
        (
            [key] => sid
            [key name] => Server ID
            [identifier] => ldap_servers_conf
            [api] => Array
                (
                    [owner] => ldap_servers
                    [api] => ldap_servers
                    [minimum_version] => 1
                    [current_version] => 1
                )

        )

    [fields] => Array
        (
            [sid] => Array
                (
                    [type] => varchar
                    [length] => 20
                    [not null] => 1
                )

            [numeric_sid] => Array
                (
                    [type] => serial
                    [unsigned] => 1
                    [not null] => 1
                    [no export] => 1
                )

            [name] => Array
                (
                    [type] => varchar
                    [length] => 255
                    [not null] => 1
                )

            [status] => Array
                (
                    [type] => int
                    [size] => tiny
                    [not null] => 1
                    [default] => 0
                )

            [type] => Array
                (
                    [type] => varchar
                    [length] => 20
                    [not null] => 
                )

            [address] => Array
                (
                    [type] => varchar
                    [length] => 255
                    [not null] => 1
                )

            [port] => Array
                (
                    [type] => int
                    [not null] => 1
                    [default] => 389
                )

            [tls] => Array
                (
                    [type] => int
                    [size] => tiny
                    [not null] => 1
                    [default] => 0
                )

            [bind_method] => Array
                (
                    [type] => int
                    [size] => tiny
                    [not null] => 1
                    [default] => 0
                )

            [basedn] => Array
                (
                    [type] => text
                )

            [binddn] => Array
                (
                    [type] => varchar
                    [length] => 511
                )

            [bindpw] => Array
                (
                    [type] => varchar
                    [length] => 255
                    [no export] => 1
                )

            [user_dn_expression] => Array
                (
                    [type] => varchar
                    [length] => 255
                    [not null] => 
                )

            [user_attr] => Array
                (
                    [type] => varchar
                    [length] => 255
                    [not null] => 1
                )

            [mail_attr] => Array
                (
                    [type] => varchar
                    [length] => 255
                    [not null] => 
                )

            [ldap_to_drupal_user] => Array
                (
                    [type] => varchar
                    [length] => 255
                    [not null] => 
                )

            [testing_drupal_username] => Array
                (
                    [type] => varchar
                    [length] => 255
                    [not null] => 
                )

            [weight] => Array
                (
                    [type] => int
                    [not null] => 1
                    [default] => 0
                )

        )

    [primary key] => Array
        (
            [0] => numeric_sid
        )

    [unique keys] => Array
        (
            [name] => Array
                (
                    [0] => name
                )

        )

    [module] => ldap_servers
    [name] => ldap_servers
)

And here's the code from the ldap_servers.install:


function ldap_servers_schema() {
  $schema['ldap_servers'] = array(
    'export' => array(
      'key' => 'sid',
      'key name' => 'Server ID',
      'primary key' => 'numeric_sid',
      'identifier' => 'ldap_servers_conf',
      'api' => array(
        'owner' => 'ldap_servers',
        'api' => 'ldap_servers',
        'minimum_version' => 1,
        'current_version' => 1,
        ),
      ),
    'fields' => array(
      'sid' => array(
        'type' => 'varchar',
        'length' => 20,
        'not null' => TRUE,
      ),
     'numeric_sid' => array(
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'Primary ID field for the table.  Only used internally.',
        'no export' => TRUE,
      ),
      'name' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
      'status' => array(
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ),
      'ldap_type' =>  array(
        'type' => 'varchar',
        'length' => 20,
        'not null' => FALSE,
      ),
      'address' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
      'port' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 389,
      ),
      'tls' => array(
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ),
      'bind_method' => array(
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ),
      'basedn' => array(
        'type' => 'text',
        'serialize' => TRUE,
      ),
      'binddn' => array(
        'type' => 'varchar',
        'length' => 511,
      ),
      'bindpw' => array(
        'type' => 'varchar',
        'length' => 255,
        'no export' => variable_get('ldap_servers_encryption' , LDAP_SERVERS_ENC_TYPE_CLEARTEXT) == LDAP_SERVERS_ENC_TYPE_CLEARTEXT ? TRUE : FALSE,
      ),
      'user_dn_expression' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => FALSE,
      ),
      'user_attr' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
      'mail_attr' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => FALSE,
      ),

      'ldap_to_drupal_user' =>  array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => FALSE,
      ),

     'testing_drupal_username' =>  array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => FALSE,
      ),

      'weight' =>  array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array('numeric_sid'),
    'unique keys' => array('name' => array('name')),
  );

  return $schema;

}
alphasupremicus’s picture

Okay, so I meticulously recorded all my LDAP settings, removed the LDAP modules, uninstalled them all, ensured the ldap tables were gone from my PostgreSQL 9 database (which they were) and then re-installed the latest LDAP module (7.x-1.0-beta2) and re-setup all my ldap configuration. Voila! All my issues are gone with this error. I guess something got whacked out and this fixed it.

johnbarclay’s picture

Sorry about this. Appreciate you being an early adopter and following through on this issue. The update may simply not work with ctools.

thekevinday’s picture

I just tried completely re-installing ldap.

As a side note, I had the following error while uninstalling:
Notice: Use of undefined constant LDAP_SERVERS_ENC_TYPE_CLEARTEXT - assumed 'LDAP_SERVERS_ENC_TYPE_CLEARTEXT' in ldap_servers_schema() (line 141 of /var/www/html/sites/all/modules/ldap/ldap_servers/ldap_servers.install).

When I re-setup ldap to match what used to be, I encountered the following:
- "Service Account Bind. Use credentials in following section to bind to ldap. This option is usually a best practice. Service account is entered in next section. " was enabled, but "DN for non-anonymous search" was empty.
- "Expression for user DN. Required when "Bind with Users Credentials" method selected. " was empty as well.

I was never able to login to the website using ldap until I used the "Bind with Users Credentials. ..." approach with a working "Expression for user DN. Required when "Bind with Users Credentials" method selected. ".

The cause of the above errors may be that I had a sufficiently old enough version of ldap when I configured the server. That old one did not have "Expression for user DN. Required when "Bind with Users Credentials" method selected." and allowed for the anonymous to be undefined when "Service Account Bind. ..." was used.

With the re-installation and re-setup, I no longer had the above errors.

Edit:
Furthermore, it seems that the following columns don't even exist in my ldap_servers database table:
- bind_method
- user_dn_expression

So at some point I was on an older version of ldap_servers that neither had those columns nor an update path to add those columns.

johnbarclay’s picture

Assigned: Unassigned » johnbarclay
Status: Active » Closed (fixed)

Thanks for following through on this. I fixed the install error message. Looks like these are all schema related issues from a lack of good upgrade code in the module.

Anyone having similar issues should install the schema module to make sure the database structure reflects the desired structure in the module. Its handy when working with beta modules.

bryancasler’s picture

Thanks for the tip on the Schema module. I found a few Discrepancies that I've reported.

#1237956: Schema module reporting some OG discrepancies
#1237974: Schema module reporting some Date discrepancies