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

Error when a resource type "quiz" is duplicated

    XMLWordPrintable

    Details

    • Affected Branches:
      MOODLE_28_STABLE
    • Fixed Branches:
      MOODLE_27_STABLE, MOODLE_28_STABLE
    • Pull from Repository:
    • Pull Master Branch:
    • Testing Instructions:
      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

            Assignee:
            timhunt Tim Hunt
            Reporter:
            cirano David Herney Bernal
            Peer reviewer:
            Mark Nelson Mark Nelson
            Integrator:
            Dan Poltawski Dan Poltawski
            Tester:
            Damyon Wiese Damyon Wiese
            Participants:
            Component watchers:
            Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan, Tim Hunt, Andrew Lyons, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Sara Arjona (@sarjona)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              11/May/15