Moodle

Cannot create child auth plugins

Details

  • Affected Branches:
    MOODLE_18_STABLE
  • Fixed Branches:
    MOODLE_18_STABLE, MOODLE_19_STABLE

Description

Cannot create child authentication plugins because it will throw a Fatal Error upon installation. Tracked down the culprit in function mnet_get_functions defined in admin/mnet/adminlib.php. Attached is a proposed fix, but several other solutions come to mind that take advantage of existing API to manage enrol/auth plugins.

Activity

Hide
Petr Škoda (skodak) added a comment -

The quick patch is in CVS, I have changed one more include to include_once(). I agree this use of include() is a potential problem because it might cause breakage in the future in some contexts, when including library files we should IMO always use xx_once(). The exceptions are our version, access, defaults where we construct arrays or set some variables.

CCing Martín, please file a new issue if other improvements needed, feel free to revert the commit

thanks for the report and patch

Show
Petr Škoda (skodak) added a comment - The quick patch is in CVS, I have changed one more include to include_once(). I agree this use of include() is a potential problem because it might cause breakage in the future in some contexts, when including library files we should IMO always use xx_once(). The exceptions are our version, access, defaults where we construct arrays or set some variables. CCing Martín, please file a new issue if other improvements needed, feel free to revert the commit thanks for the report and patch
Hide
Mark Nielsen added a comment -

Thanks Petr for your quick response! Having the patch in so quickly is really appreciated

I agree with using the x_once() approach since one never knows when it might have already been included, especially with plugins and class definitions. Along this line, I was wondering if Moodle has a coding preference to write includes/requires as statements or as functions. So:

require_once 'path/to/file';

or

require_once('path/to/file');

Cheers and thanks again Petr!

Show
Mark Nielsen added a comment - Thanks Petr for your quick response! Having the patch in so quickly is really appreciated I agree with using the x_once() approach since one never knows when it might have already been included, especially with plugins and class definitions. Along this line, I was wondering if Moodle has a coding preference to write includes/requires as statements or as functions. So: require_once 'path/to/file'; or require_once('path/to/file'); Cheers and thanks again Petr!
Hide
Petr Škoda (skodak) added a comment -

there is no official way - though most ppl use the function style calls

Show
Petr Škoda (skodak) added a comment - there is no official way - though most ppl use the function style calls
Hide
Martín Langhoff added a comment -

ACK! Good patch - wonder how that got in there without anyone realising.

Show
Martín Langhoff added a comment - ACK! Good patch - wonder how that got in there without anyone realising.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: