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

Problems handling content copied from MS Word during backup/restore

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 2.3
    • Fix Version/s: None
    • Component/s: Backup, Quiz
    • Labels:
    • Workaround:
      Hide

      Replace the copied Word content with simpler text, then backup and restore.

      Show
      Replace the copied Word content with simpler text, then backup and restore.
    • Affected Branches:
      MOODLE_23_STABLE

      Description

      We've got several support requests related to duplication or quiz copy creations in 2.3.1. All of them reported this error: error/error_question_answers_missing_in_db

      The problems seems to be related to special characters in the content. Its interesting to know which content or characters can create such a problem that its possible to identify such problems easier. Its clear that copy-and-paste from MS Word never is a good idea. But it looks that the system behaviour is different in 1.9 systems and in 2.x systems. Will it be possible to create an error message that advices to the id of the critcal content/question in standard modus without enabling debug modus on developer level.

      Or do you think there is a problem in the backup scripts?

      Here are two examples that created the problem.

      Example 1:

      Debug info:
      Error code: error_question_answers_missing_in_db
      $a contents: stdClass Object
      (
      [filequestionid] => 11
      [dbquestionid] => 11
      [answer] => <p style="margin-bottom: 0cm; line-height: 100%;"><span style="color: #000000;">Professionalität in der Planung und vor allem in der Durchführung ist für den</span></p>
      <p style="margin-bottom: 0cm; line-height: 100%;"><span style="color: #000000;">Erfolg einer Aktion sehr wichtig.</span></p>
      )
      Stack trace:
       
          line 164 of /backup/moodle2/restore_qtype_plugin.class.php: restore_step_exception thrown
          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 163 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 315 of /backup/controller/restore_controller.class.php: call to restore_plan->execute()
          line 91 of /course/modduplicate.php: call to restore_controller->execute_plan()


      Second example:

      In an other question we found a lot of MS Word internal formats that was copied into the question by a teacher:

      I've shortened the error message.

      Error code: error_question_answers_missing_in_db
      $a contents: stdClass Object
      (
      [filequestionid] => 6810
      [dbquestionid] => 6810
      [answer] => <p><!--[if gte mso 9]><xml>
      <w:WordDocument>
      <w:View>Normal</w:View>
      <w:Zoom>0</w:Zoom>
      <w:TrackMoves/>
      <w:TrackFormatting/>
      <w:HyphenationZone>21</w:HyphenationZone>
      <w:PunctuationKerning/>
      <w:ValidateAgainstSchemas/>
      <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
      <w:IgnoreMixedContent>false</w:IgnoreMixedContent>
      <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
      <w:DoNotPromoteQF/>
      <w:LidThemeOther>DE</w:LidThemeOther>
      <w:LidThemeAsian>X-NONE</w:LidThemeAsian>
      <w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
       
      [[...]]
       
      </m:mathPr></w:WordDocument>
      </xml><![endif]--><!--[if gte mso 9]><xml>
      <w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"
      DefSemiHidden="true" DefQFormat="false" DefPriority="99"
      LatentStyleCount="267">
       
      [[...]]
       
      <w:LsdException Locked="false" Priority="33" SemiHidden="false"
      UnhideWhenUsed="false" QFormat="true" Name="Book Title"/>
      <w:LsdException Locked="false" Priority="37" Name="Bibliography"/>
      <w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading"/>
      </w:LatentStyles>
      </xml><![endif]--><!--[if gte mso 10]>
      <style>
      /* Style Definitions */
      table.MsoNormalTable
      {mso-style-name:"Normale Tabelle";
      mso-tstyle-rowband-size:0;
       
      [[...]]
       
      mso-pagination:widow-orphan;
      font-size:10.0pt;
      font-family:"Times New Roman","serif";}
      </style>
      <![endif]--></p>
      <p class="TAufzBstabe1" style="mso-list: l0 level1 lfo2;">Sie müssen als Akutmittel bei der entsprechenden Infektion, z.B. Tuberkulinum bei Tuberkulose, gegeben werden.</p>
      <p> </p>
      <!--[if gte mso 9]><xml>
      <w:WordDocument>
      <w:View>Normal</w:View>
      <w:Zoom>0</w:Zoom>
       
      [[...]]
       
      <w:CachedColBalance/>
      </w:Compatibility>
      <m:mathPr>
      <m:mathFont m:val="Cambria Math"/>
       
       
      [[...]]
       
       
      <m:naryLim m:val="undOvr"/>
      </m:mathPr></w:WordDocument>
      </xml><![endif]--><!--[if gte mso 9]><xml>
      <w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"
      DefSemiHidden="true" DefQFormat="false" DefPriority="99"
      LatentStyleCount="267">
      <w:LsdException Locked="false" Priority="0" SemiHidden="false"
      UnhideWhenUsed="false" QFormat="true" Name="Normal"/>
      <w:LsdException Locked="false" Priority="0" SemiHidden="false"
      UnhideWhenUsed="false" QFormat="true" Name="heading 1"/>
      <w:LsdException Locked="false" Priority="0" QFormat="true" Name="heading 2"/>
       
       
      [[...]]
       
       
      <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9"/>
      <w:LsdException Locked="false" Priority="39" Name="toc 1"/>
       
       
      [[...]]
       
       
      <w:LsdException Locked="false" Priority="39" Name="toc 9"/>
      <w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption"/>
      <w:LsdException Locked="false" Priority="10" SemiHidden="false"
      UnhideWhenUsed="false" QFormat="true" Name="Title"/>
       
      [[...]]
       
      <w:LsdException Locked="false" Priority="32" SemiHidden="false"
      UnhideWhenUsed="false" QFormat="true" Name="Intense Reference"/>
      <w:LsdException Locked="false" Priority="33" SemiHidden="false"
      UnhideWhenUsed="false" QFormat="true" Name="Book Title"/>
      <w:LsdException Locked="false" Priority="37" Name="Bibliography"/>
      <w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading"/>
      </w:LatentStyles>
      </xml><![endif]--><!--[if gte mso 10]>
      <style>
      /* Style Definitions */
      table.MsoNormalTable
      {mso-style-name:"Normale Tabelle";
      mso-tstyle-rowband-size:0;
      mso-tstyle-colband-size:0;
      mso-style-noshow:yes;
      mso-style-priority:99;
      mso-style-qformat:yes;
      mso-style-parent:"";
      mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
      mso-para-margin:0cm;
      mso-para-margin-bottom:.0001pt;
      mso-pagination:widow-orphan;
      font-size:10.0pt;
      font-family:"Times New Roman","serif";}
      </style>
      <![endif]-->
      <p class="TAufzBstabe1" style="mso-list: l0 level1 lfo2;"><span style="mso-bidi-font-family: 'Arial Unicode MS';"><span style="mso-list: Ignore;">a.<span style="font: 7.0pt 'Times New Roman';">     </span></span></span>Sie müssen in sehr hohen Potenzen gegeben werden - nicht unter 1M.</p>
      )
      Stack trace:
       
          line 164 of /backup/moodle2/restore_qtype_plugin.class.php: restore_step_exception thrown
          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 163 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 315 of /backup/controller/restore_controller.class.php: call to restore_plan->execute()
          line 91 of /course/modduplicate.php: call to restore_controller->execute_plan()

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                1 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: