Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-29432

Quiz question copy error (restore)


    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Minor Minor
    • None
    • 2.0.4, 2.1.1
    • Backup, Questions

      Steps to reproduce:

      1. Create a quiz
      2. Add a multi choice question where two answers have the exact same answer text (Yes, I know this shouldn't happen in real life, but nothing prevents me from doing this).
      3. Copy the quiz using duplication (I assume you could also do just a regular backup/restore).
      4. You will see the following error:

        Error: mdb->get_record() found more than one record!
        line 1292 of /lib/dml/moodle_database.php: call to debugging()
        line 1355 of /lib/dml/moodle_database.php: call to moodle_database->get_record_sql()
        line 151 of /backup/moodle2/restore_qtype_plugin.class.php: call to moodle_database->get_field_sql()
        line 131 of /backup/util/plan/restore_structure_step.class.php: call to restore_qtype_plugin->process_question_answer()
        line 103 of /backup/util/helper/restore_structure_parser_processor.class.php: call to restore_structure_step->process()
        line 125 of /backup/util/xml/parser/processors/grouped_parser_processor.class.php: call to restore_structure_parser_processor->dispatch_chunk()
        line 91 of /backup/util/helper/restore_structure_parser_processor.class.php: call to grouped_parser_processor->postprocess_chunk()
        line 148 of /backup/util/xml/parser/processors/simplified_parser_processor.class.php: call to restore_structure_parser_processor->postprocess_chunk()
        line 92 of /backup/util/xml/parser/processors/progressive_parser_processor.class.php: call to simplified_parser_processor->process_chunk()
        line 169 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser_processor->receive_chunk()
        line 253 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser->publish()
        line ? of unknownfile: call to progressive_parser->end_tag()
        line 158 of /backup/util/xml/parser/progressive_parser.class.php: call to xml_parse()
        line 137 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser->parse()
        line 105 of /backup/util/plan/restore_structure_step.class.php: call to progressive_parser->process()
        line 153 of /backup/util/plan/base_task.class.php: call to restore_structure_step->execute()
        line 148 of /backup/util/plan/base_plan.class.php: call to base_task->execute()
        line 157 of /backup/util/plan/restore_plan.class.php: call to base_plan->execute()
        line 302 of /backup/controller/restore_controller.class.php: call to restore_plan->execute()
        line 89 of /course/modduplicate.php: call to restore_controller->execute_plan()

      In restore_qtype_plugin::process_question_answer() there is a query to get a record based on the answer text, which of course is returning two answer records.


      • Looks like restore_create_categories_and_questions::process_question_hint() uses same logic as question_answer. So if a question has two hints that are the same, you will get the same error. Not verified!

            timhunt Tim Hunt
            bushido Mark Nielsen
            4 Vote for this issue
            6 Start watching this issue


                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.