Merge branch 'MDL-65605-master' of git://github.com/rezaies/moodle

This commit is contained in:
Sara Arjona 2019-05-21 13:47:31 +02:00
commit c13d1d2518
2 changed files with 4 additions and 2 deletions

View File

@ -59,6 +59,7 @@ class lesson_import_form extends moodleform {
* @param array $data the submitted data.
* @param array $errors the errors so far.
* @return array the updated errors.
* @throws moodle_exception
*/
protected function validate_uploaded_file($data, $errors) {
global $CFG;
@ -69,7 +70,7 @@ class lesson_import_form extends moodleform {
}
$files = $this->get_draft_files('questionfile');
if (count($files) < 1) {
if (!is_array($files) || count($files) < 1) {
$errors['questionfile'] = get_string('required');
return $errors;
}

View File

@ -112,6 +112,7 @@ class question_import_form extends moodleform {
* @param array $data the submitted data.
* @param array $errors the errors so far.
* @return array the updated errors.
* @throws moodle_exception
*/
protected function validate_uploaded_file($data, $errors) {
if (empty($data['newfile'])) {
@ -120,7 +121,7 @@ class question_import_form extends moodleform {
}
$files = $this->get_draft_files('newfile');
if (count($files) < 1) {
if (!is_array($files) || count($files) < 1) {
$errors['newfile'] = get_string('required');
return $errors;
}