MDL-81267 mod_data: Clean field type before inclusion

* Filter out wrong field types when restoring or creating a field.
This commit is contained in:
Laurent David
2024-04-17 10:33:08 +02:00
committed by Sara Arjona
parent dadffe8989
commit ffa045e099
4 changed files with 6 additions and 0 deletions
@@ -103,6 +103,7 @@ class csv_entries_importer extends entries_importer {
unset($fieldnames[$id]); // To ensure the user provided content fields remain in the array once flipped.
} else {
$field = $rawfields[$name];
$field->type = clean_param($field->type, PARAM_ALPHA);
$filepath = "$CFG->dirroot/mod/data/field/$field->type/field.class.php";
if (!file_exists($filepath)) {
$errorfield .= "'$name' ";