diff --git a/admin/tool/uploadcourse/classes/helper.php b/admin/tool/uploadcourse/classes/helper.php index 0a3e12e9698..5ffc6779e3f 100644 --- a/admin/tool/uploadcourse/classes/helper.php +++ b/admin/tool/uploadcourse/classes/helper.php @@ -164,7 +164,10 @@ class tool_uploadcourse_helper { if (!empty($enrolmethods)) { $enrolmentplugins = self::get_enrolment_plugins(); foreach ($enrolmethods as $key => $method) { - if (!array_key_exists($method, $enrolmentplugins)) { + if (empty($method)) { + // The enrolment method is not specified, we skip it. + continue; + } else if (!array_key_exists($method, $enrolmentplugins)) { // Unknown enrolment method. $unknownmethods[] = $method; continue; diff --git a/admin/tool/uploadcourse/tests/helper_test.php b/admin/tool/uploadcourse/tests/helper_test.php index 22569e3a000..b10cdaf6c64 100644 --- a/admin/tool/uploadcourse/tests/helper_test.php +++ b/admin/tool/uploadcourse/tests/helper_test.php @@ -79,6 +79,7 @@ class tool_uploadcourse_helper_testcase extends advanced_testcase { 'enrolment_5_test2' => 'test2', 'enrolment_5_test1' => 'test1', 'enrolment_5' => 'flatfile', + 'enrolment_6' => '', ); $expected = array( 'self' => array(