by Marcin Rożek.
I also have the same problem and i can't backup any course.
With Grok AI i've added in question/classes/local/bank/random_question_loader.php:
/**
* Get the list of available questions for the given criteria.
*
* @param array $filters filter array
* @param int $limit Maximum number of results to return.
* @param int $offset Number of items to skip from the begging of the result set.
* @param string[] $fields The fields to return for each question.
* @return \stdClass[] The list of question records
*/
public function get_filtered_questions($filters, $limit = 100, $offset = 0, $fields = []) {
global $DB;
// Ensure $filters is an array - added by Grok
if (!is_array($filters)) {
debugging('Invalid filters passed to get_filtered_questions; defaulting to empty array.', DEBUG_DEVELOPER);
$filters = [];
}
And this is added in error when i'm trying course backup:
Warning: Undefined array key "filter" in /var/www/html/moodle/backup/moodle2/backup_stepslib.php on line 311
Invalid filters passed to get_filtered_questions; defaulting to empty array.
line 493 of /question/classes/local/bank/random_question_loader.php: call to debugging()
line 311 of /backup/moodle2/backup_stepslib.php: call to core_question\local\bank\random_question_loader->get_filtered_questions()
line 62 of /mod/quiz/backup/moodle2/backup_quiz_stepslib.php: call to backup_questions_activity_structure_step->annotate_set_reference_bank_entries()
line 95 of /backup/util/plan/backup_structure_step.class.php: call to backup_quiz_activity_structure_step->define_structure()
line 199 of /backup/util/plan/base_task.class.php: call to backup_structure_step->execute()
line 242 of /backup/moodle2/backup_activity_task.class.php: call to base_task->execute()
line 191 of /backup/util/plan/base_plan.class.php: call to backup_activity_task->execute()
line 145 of /backup/util/plan/backup_plan.class.php: call to base_plan->execute()
line 567 of /backup/controller/backup_controller.class.php: call to backup_plan->execute()
line 136 of /backup/util/ui/backup_ui.class.php: call to backup_controller->execute_plan()
line 179 of /backup/backup.php: call to backup_ui->execute()
Why $filters is not an array or is empty?
Moodle 5.0.2 Build 20250919
With Grok AI i've added in question/classes/local/bank/random_question_loader.php:
/**
* Get the list of available questions for the given criteria.
*
* @param array $filters filter array
* @param int $limit Maximum number of results to return.
* @param int $offset Number of items to skip from the begging of the result set.
* @param string[] $fields The fields to return for each question.
* @return \stdClass[] The list of question records
*/
public function get_filtered_questions($filters, $limit = 100, $offset = 0, $fields = []) {
global $DB;
// Ensure $filters is an array - added by Grok
if (!is_array($filters)) {
debugging('Invalid filters passed to get_filtered_questions; defaulting to empty array.', DEBUG_DEVELOPER);
$filters = [];
}
And this is added in error when i'm trying course backup:
Warning: Undefined array key "filter" in /var/www/html/moodle/backup/moodle2/backup_stepslib.php on line 311
Invalid filters passed to get_filtered_questions; defaulting to empty array.
line 493 of /question/classes/local/bank/random_question_loader.php: call to debugging()
line 311 of /backup/moodle2/backup_stepslib.php: call to core_question\local\bank\random_question_loader->get_filtered_questions()
line 62 of /mod/quiz/backup/moodle2/backup_quiz_stepslib.php: call to backup_questions_activity_structure_step->annotate_set_reference_bank_entries()
line 95 of /backup/util/plan/backup_structure_step.class.php: call to backup_quiz_activity_structure_step->define_structure()
line 199 of /backup/util/plan/base_task.class.php: call to backup_structure_step->execute()
line 242 of /backup/moodle2/backup_activity_task.class.php: call to base_task->execute()
line 191 of /backup/util/plan/base_plan.class.php: call to backup_activity_task->execute()
line 145 of /backup/util/plan/backup_plan.class.php: call to base_plan->execute()
line 567 of /backup/controller/backup_controller.class.php: call to backup_plan->execute()
line 136 of /backup/util/ui/backup_ui.class.php: call to backup_controller->execute_plan()
line 179 of /backup/backup.php: call to backup_ui->execute()
Why $filters is not an array or is empty?
Moodle 5.0.2 Build 20250919