Details

    • Type: Bug
    • Status: Closed
    • Priority: 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

      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

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

              Hide
              howardsmiller Howard Miller added a comment -

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

              Show
              howardsmiller Howard Miller added a comment - Joseph, Could you attach an XML file that exhibits this problem please.
              Hide
              rezeau 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
              rezeau 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
              mchurch 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
              mchurch 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
              howardsmiller 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
              howardsmiller 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
              mchurch 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
              mchurch 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
              howardsmiller 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
              howardsmiller 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
              andyjdavis Andrew Davis added a comment -

              Question import seems to be working fine now. Closing.

              Show
              andyjdavis 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:
                    Fix Release Date:
                    3/Mar/08