Hi,

I found a bug, when trying to add new users from update.php. The site has a complicated process behind it and when calling update.php (or drush updb) the module's hook_init implementation (simplesamlphp_auth_init) is being called with the following error is being triggered.

An AJAX HTTP error occurred. HTTP Result Code: 200 Debugging information follows. Path: https://my-site.com/update.php?op=selection&token=9oMr3dnyqXy92Gh7ZDWjpaeNQLnSCAE8DRZ0vdh-VbM&id=122736&op=do StatusText: OK ResponseText: Fatal error: Call to a member function isAuthenticated() on a non-object in sites/all/modules/contrib/simplesamlphp_auth/simplesamlphp_auth.module on line 363

It seems that in update.php hook_init() is not being triggered (see the code section below from update.php), and thus SimpleSAMLphp is not being included.

/**
 * Global flag indicating that update.php is being run.
 *
 * When this flag is set, various operations do not take place, such as invoking
 * hook_init() and hook_exit(), css/js preprocessing, and translation.
 */
define('MAINTENANCE_MODE', 'update');

I've attached a patch to fix this, including the SimpleSAMLphp in _simplesamlphp_auth_isEnabled() function. Basically, if the authentication via SimpleSAML is enabled, then also include the files.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Alex Dicianu’s picture

Alex Dicianu’s picture

snufkin’s picture

Version: 7.x-2.0-alpha2 » 7.x-3.x-dev
Status: Needs review » Needs work

The way the module loads the includes has been changed in 3.x, could you help us testing if this issue is resolved in 7.x-3.x-dev? I'd only like to commit bugfixes to 2.x from now on, in order to make sure we have a stable module for everyone.

rtdean93’s picture

I tested the #1 patch (https://www.drupal.org/files/issues/D7-simplasamlphp_auth-fix-fatal-erro...) against 7.x-2.0-alpha2 and it solved our problem. I can create users via update hook.

sherakama’s picture

Updating to the 3.x version (commit: 6e92be67b007e4e9f4a071b9a82c7db8fbcee2af) fixed this issue for me.

Thanks!