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

Error when a resource type "quiz" is duplicated

    XMLWordPrintable

Details

    • MOODLE_28_STABLE
    • MOODLE_27_STABLE, MOODLE_28_STABLE
    • Hide
      1. Create a new course.
      2. Restore the attached single-activity backup into it.
      3. That should give you a quiz.
      4. Turn off JavaScript (so you can easily see any errors) then duplicate the quiz.

      If you don't want to turn off JavaScript, you can look in the PHP error logs to verify that with this fix there are no notices.

      Show
      Create a new course. Restore the attached single-activity backup into it. That should give you a quiz. Turn off JavaScript (so you can easily see any errors) then duplicate the quiz. If you don't want to turn off JavaScript, you can look in the PHP error logs to verify that with this fix there are no notices.

    Description

      I am using the function duplicate_module for a course format. When I use this function in a quiz module an error of development level occurred. I check the official duplicate functionality and the error occur to.
      Note: The error only occur if $CFG->usetags is enabled.

      The log of error is:

      *******************************************************************************************
      Notice: Trying to get property of non-object in /var/www/html/moodle28/backup/moodle2/restore_stepslib.php on line 3858
      You should specify the component and contextid of the item being tagged in your call to tag_assign.

      line 992 of /tag/lib.php: call to debugging()
      line 168 of /tag/lib.php: call to tag_assign()
      line 3858 of /backup/moodle2/restore_stepslib.php: call to tag_set()
      line 137 of /backup/util/plan/restore_structure_step.class.php: call to restore_create_categories_and_questions->process_tag()
      line 103 of /backup/util/helper/restore_structure_parser_processor.class.php: call to restore_structure_step->process()
      line 151 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 190 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser_processor->receive_chunk()
      line 278 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser->publish()
      line ? of unknownfile: call to progressive_parser->end_tag()
      line 179 of /backup/util/xml/parser/progressive_parser.class.php: call to xml_parse()
      line 158 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser->parse()
      line 110 of /backup/util/plan/restore_structure_step.class.php: call to progressive_parser->process()
      line 181 of /backup/util/plan/base_task.class.php: call to restore_structure_step->execute()
      line 177 of /backup/util/plan/base_plan.class.php: call to base_task->execute()
      line 167 of /backup/util/plan/restore_plan.class.php: call to base_plan->execute()
      line 333 of /backup/controller/restore_controller.class.php: call to restore_plan->execute()
      line 3507 of /course/lib.php: call to restore_controller->execute_plan()
      line 90 of /course/mod.php: call to duplicate_module()
      *******************************************************************************************

      Attachments

        Activity

          People

            timhunt Tim Hunt
            cirano David Herney Bernal
            Mark Nelson Mark Nelson
            Dan Poltawski Dan Poltawski
            Damyon Wiese Damyon Wiese
            Adrian Greeve, David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo, Tim Hunt, Ilya Tregubov, Kevin Percy, Mathew May, Mihail Geshoski, Shamim Rezaie, David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              11/May/15