auth saml config form does not work

Bug #670546 reported by Rich Trott
18
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
High
Rich Trott

Bug Description

Trying to use the config form for the auth:saml plugin/extension results in the form submission hanging and this appears in the error log:

PHP Fatal error: Cannot use object of type Pieform as array in /web/mahara/htdocs/auth/saml/lib.php on line 461, referer: https://example.com/admin/extensions/pluginconfig.php?plugintype=auth&pluginname=saml

I'm using a checkout of the current Master branch, 1.4.0dev. This problem does not appear to be in the release branches. I'm running Linux (RedHat CentOS 5) + Postgres.

description: updated
Revision history for this message
Richard Mansfield (richard-mansfield) wrote :

This seems like a bad bug. It looks like Mahara forces auth plugins to use the same function names (validate_config_options, save_config_options) for plugin configuration and instance configuration, and then passes different parameters to the function depending on whether it's doing plugin or instance config. It only affects saml, because that's the only auth plugin that has plugin configuration.

To fix it without breaking any contributed plugins out ther, maybe we should make the auth instance config stuff in htdocs/admin/users/addauthority.php check for the existence of validate_instance_config_options, save_instance_config_options functions and if they exist, use those instead of validate_config_options, save_config_options.

Or else just change the names of all auth plugins to use validate_instance_config_options etc., and just let any contrib auth plugins break.

Revision history for this message
Rich Trott (richard-trott) wrote :

Here's a patch that will let SAML configuration work whether it receives a Pieform object (which is what triggers this bug) or an array (which it apparently still needs to accept in other situations).

I think this resolves the narrow buggy behavior in SAML reported here. I guess the larger root-cause bug you (Richard M.) refer to above should probably be filed as a separate bug?

Revision history for this message
Rich Trott (richard-trott) wrote :

Uh, yeah, let's try that again, but this time I'll make sure my code uses Unix line-endings before making the patch....

Revision history for this message
Rich Trott (richard-trott) wrote :

It looks like this bug was introduced by the commit done to fix bug #653839. https://bugs.launchpad.net/mahara/+bug/653839

That patch removed code that does a very similar thing that the patch I submitted here does, except that code produces errors/warnings because it tries to use get_class on a variable that may or may not be an object. The patch I submitted uses instanceof, so it doesn't generate errors/warnings if the variable turns out to be an array rather than an object.

Perhaps a hybrid of my patch and the original code would be best? Attached.

Changed in mahara:
status: New → Confirmed
Changed in mahara:
milestone: none → 1.4.0
importance: Undecided → High
Revision history for this message
Rich Trott (richard-trott) wrote :

Looks like I goofed up the whitespace on that patch, per usual, but other than that... Anything I should do to expedite this? SAML cannot be configured (and thus cannot be used) without this patch or a similar fix.

Revision history for this message
Rich Trott (richard-trott) wrote :

If it helps at all, here's the patch with the whitespace that shouldn't be there removed.

Revision history for this message
PiersHarding (piersharding) wrote :

Hi Richard -

Thanks for your patch. I've applied it and pushed to master.

Cheers,
Piers Harding.

Changed in mahara:
status: Confirmed → Fix Committed
Changed in mahara:
assignee: nobody → Rich Trott (richard-trott)
Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.