Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.9
    • Fix Version/s: 1.8.5, 1.9, 2.0
    • Component/s: Questions
    • Labels:
      None
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_18_STABLE, MOODLE_19_STABLE, MOODLE_20_STABLE
    • Rank:
      29984

      Description

      When importing questions from XML file, 2 error message are displayed (if debuggin is set to display PHP notices):
      Notice: Array to string conversion in moodle\question\format.php on line 320
      Notice: Undefined offset: 1 in \moodle\question\format.php on line 324
      Joseph

        Issue Links

          Activity

          Hide
          Howard Miller added a comment -

          Joseph, Could you attach an XML file that exhibits this problem please.

          Show
          Howard Miller added a comment - Joseph, Could you attach an XML file that exhibits this problem please.
          Hide
          Joseph Rézeau added a comment -

          Howard,
          Here is export file, containing only one multiple-choice question. It has been exported from moodle 1.9 (latest available version). Upon re-importing into moodle 1.9 (with debugging set on) I get the following error messages:

          Parsing questions from import file.
          Importing 2 questions from file
          Notice: Array to string conversion in ...\moodle\question\format.php on line 320
          Notice: Undefined offset: 1 in ...\moodle\question\format.php on line 324

          Why does it belive it is importing 2 questions rather than one?

          Joseph

          Show
          Joseph Rézeau added a comment - Howard, Here is export file, containing only one multiple-choice question. It has been exported from moodle 1.9 (latest available version). Upon re-importing into moodle 1.9 (with debugging set on) I get the following error messages: Parsing questions from import file. Importing 2 questions from file Notice: Array to string conversion in ...\moodle\question\format.php on line 320 Notice: Undefined offset: 1 in ...\moodle\question\format.php on line 324 Why does it belive it is importing 2 questions rather than one? Joseph
          Hide
          Mike Churchward added a comment - - edited

          The text of the category entry wasn't being sent to the 'create_category_path' function. Instead it was sending an object.

          Show
          Mike Churchward added a comment - - edited The text of the category entry wasn't being sent to the 'create_category_path' function. Instead it was sending an object.
          Hide
          Howard Miller added a comment -

          Applied fix cannot possibly be correct...

          $catpath = $question->category['text'][0]'#';

          Could only ever apply to the XML format, as this has been placed in the parent class it breaks (at least) GIFT category import.

          Show
          Howard Miller added a comment - Applied fix cannot possibly be correct... $catpath = $question->category ['text'] [0] '#' ; Could only ever apply to the XML format, as this has been placed in the parent class it breaks (at least) GIFT category import.
          Hide
          Mike Churchward added a comment -

          Hmmmm... I see what you are saying. I guess the correct thing to do is override the 'importprocess' function in the '/format/xml/format.php' file.

          You doing that?

          Show
          Mike Churchward added a comment - Hmmmm... I see what you are saying. I guess the correct thing to do is override the 'importprocess' function in the '/format/xml/format.php' file. You doing that?
          Hide
          Howard Miller added a comment -

          It was just a mistake in question/format/xml/format.php. It wasn't looking for the category info in the right place in the xml tree.

          Show
          Howard Miller added a comment - It was just a mistake in question/format/xml/format.php. It wasn't looking for the category info in the right place in the xml tree.
          Hide
          Andrew Davis added a comment -

          Question import seems to be working fine now. Closing.

          Show
          Andrew Davis added a comment - Question import seems to be working fine now. Closing.

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: