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

Quiz/Question XML import fails

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.0
    • Component/s: Questions, Quiz
    • Labels:
      None
    • Affected Branches:
      MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE

      Description

      When I try and import the attached quiz XML I get the following errors (below).

      I have spoken to Tim Hunt and he has said it's something to do with the way the save_question_options functions have been changed. These functions are called from two places. One gets its input from a moodle form, the other from the imported XML. The import functions that deal with the XML files are not correctly formating the data to pass to the save functions.

      I also have a longer version of the XML file to test with once the fix is in place.

      ----------------------------------------------------------------------------------------------------------------
      Parsing questions from import file.

      ( ! ) Notice: Undefined index: answer in /fs2/www/html/jecb5/core-moodle/question/format/xml/format.php on line 570
      Call Stack

      1. Time Memory Function Location
        1 0.0004 700072 {main}( ) ../import.php:0
        2 0.6434 25534552 qformat_default->importprocess( ) ../import.php:111
        3 0.6878 27680240 qformat_xml->readquestions( ) ../format.php:249
        4 0.6971 28020728 qformat_xml->import_essay( ) ../format.php:812

        ( ! ) Warning: array_pop() expects parameter 1 to be array, null given in /fs2/www/html/jecb5/core-moodle/question/format/xml/format.php on line 571
        Call Stack
        # Time Memory Function Location
        1 0.0004 700072 {main}

        ( ) ../import.php:0
        2 0.6434 25534552 qformat_default->importprocess( ) ../import.php:111
        3 0.6878 27680240 qformat_xml->readquestions( ) ../format.php:249
        4 0.6971 28020728 qformat_xml->import_essay( ) ../format.php:812
        5 0.6976 28025976 array_pop ( ) ../format.php:571
        Importing 7 questions from file

      1. Below you will find 5 locations in Derbyshire. Each location sits on a river. Please match the correct river to the location it flows through.

      ( ! ) Notice: Undefined variable: files in /fs2/www/html/jecb5/core-moodle/question/type/match/questiontype.php on line 82
      Call Stack

      1. Time Memory Function Location
        1 0.0004 700072 {main}( ) ../import.php:0
        2 0.6434 25534552 qformat_default->importprocess( ) ../import.php:111
        3 0.7142 27947832 question_match_qtype->save_question_options( ) ../format.php:351

        ( ! ) Warning: Invalid argument supplied for foreach() in /fs2/www/html/jecb5/core-moodle/question/type/match/questiontype.php on line 82
        Call Stack
        # Time Memory Function Location
        1 0.0004 700072 {main}

        ( ) ../import.php:0
        2 0.6434 25534552 qformat_default->importprocess( ) ../import.php:111
        3 0.7142 27947832 question_match_qtype->save_question_options( ) ../format.php:351

      ( ! ) Notice: Undefined variable: files in /fs2/www/html/jecb5/core-moodle/question/type/match/questiontype.php on line 82
      Call Stack

      1. Time Memory Function Location
        1 0.0004 700072 {main}( ) ../import.php:0
        2 0.6434 25534552 qformat_default->importprocess( ) ../import.php:111
        3 0.7142 27947832 question_match_qtype->save_question_options( ) ../format.php:351

        ( ! ) Warning: Invalid argument supplied for foreach() in /fs2/www/html/jecb5/core-moodle/question/type/match/questiontype.php on line 82
        Call Stack
        # Time Memory Function Location
        1 0.0004 700072 {main}

        ( ) ../import.php:0
        2 0.6434 25534552 qformat_default->importprocess( ) ../import.php:111
        3 0.7142 27947832 question_match_qtype->save_question_options( ) ../format.php:351

      ( ! ) Notice: Undefined variable: files in /fs2/www/html/jecb5/core-moodle/question/type/match/questiontype.php on line 82
      Call Stack

      1. Time Memory Function Location
        1 0.0004 700072 {main}( ) ../import.php:0
        2 0.6434 25534552 qformat_default->importprocess( ) ../import.php:111
        3 0.7142 27947832 question_match_qtype->save_question_options( ) ../format.php:351

        ( ! ) Warning: Invalid argument supplied for foreach() in /fs2/www/html/jecb5/core-moodle/question/type/match/questiontype.php on line 82
        Call Stack
        # Time Memory Function Location
        1 0.0004 700072 {main}

        ( ) ../import.php:0
        2 0.6434 25534552 qformat_default->importprocess( ) ../import.php:111
        3 0.7142 27947832 question_match_qtype->save_question_options( ) ../format.php:351

      ( ! ) Notice: Undefined variable: files in /fs2/www/html/jecb5/core-moodle/question/type/match/questiontype.php on line 82
      Call Stack

      1. Time Memory Function Location
        1 0.0004 700072 {main}( ) ../import.php:0
        2 0.6434 25534552 qformat_default->importprocess( ) ../import.php:111
        3 0.7142 27947832 question_match_qtype->save_question_options( ) ../format.php:351

        ( ! ) Warning: Invalid argument supplied for foreach() in /fs2/www/html/jecb5/core-moodle/question/type/match/questiontype.php on line 82
        Call Stack
        # Time Memory Function Location
        1 0.0004 700072 {main}

        ( ) ../import.php:0
        2 0.6434 25534552 qformat_default->importprocess( ) ../import.php:111
        3 0.7142 27947832 question_match_qtype->save_question_options( ) ../format.php:351

      ( ! ) Notice: Undefined variable: files in /fs2/www/html/jecb5/core-moodle/question/type/match/questiontype.php on line 82
      Call Stack

      1. Time Memory Function Location
        1 0.0004 700072 {main}( ) ../import.php:0
        2 0.6434 25534552 qformat_default->importprocess( ) ../import.php:111
        3 0.7142 27947832 question_match_qtype->save_question_options( ) ../format.php:351

        ( ! ) Warning: Invalid argument supplied for foreach() in /fs2/www/html/jecb5/core-moodle/question/type/match/questiontype.php on line 82
        Call Stack
        # Time Memory Function Location
        1 0.0004 700072 {main}

        ( ) ../import.php:0
        2 0.6434 25534552 qformat_default->importprocess( ) ../import.php:111
        3 0.7142 27947832 question_match_qtype->save_question_options( ) ../format.php:351

      ( ! ) Notice: Undefined variable: files in /fs2/www/html/jecb5/core-moodle/question/type/match/questiontype.php on line 82
      Call Stack

      1. Time Memory Function Location
        1 0.0004 700072 {main}( ) ../import.php:0
        2 0.6434 25534552 qformat_default->importprocess( ) ../import.php:111
        3 0.7142 27947832 question_match_qtype->save_question_options( ) ../format.php:351

        ( ! ) Warning: Invalid argument supplied for foreach() in /fs2/www/html/jecb5/core-moodle/question/type/match/questiontype.php on line 82
        Call Stack
        # Time Memory Function Location
        1 0.0004 700072 {main}

        ( ) ../import.php:0
        2 0.6434 25534552 qformat_default->importprocess( ) ../import.php:111
        3 0.7142 27947832 question_match_qtype->save_question_options( ) ../format.php:351

      ( ! ) Notice: Undefined variable: files in /fs2/www/html/jecb5/core-moodle/question/type/match/questiontype.php on line 82
      Call Stack

      1. Time Memory Function Location
        1 0.0004 700072 {main}( ) ../import.php:0
        2 0.6434 25534552 qformat_default->importprocess( ) ../import.php:111
        3 0.7142 27947832 question_match_qtype->save_question_options( ) ../format.php:351

        ( ! ) Warning: Invalid argument supplied for foreach() in /fs2/www/html/jecb5/core-moodle/question/type/match/questiontype.php on line 82
        Call Stack
        # Time Memory Function Location
        1 0.0004 700072 {main}

        ( ) ../import.php:0
        2 0.6434 25534552 qformat_default->importprocess( ) ../import.php:111
        3 0.7142 27947832 question_match_qtype->save_question_options( ) ../format.php:351

      2. This short assessment showcases the question types that are available in Moodle 1.9. They are classified by the type of response required and fall into three categories * numeric * text * selection The rubric that precedes each of these categories explains a little more about the possibilities and constraints offered by each question type within the category. In all cases you are allowed one try at each question, though you can return to your response and amend it as many times as you wish prior to submission. As this is a formative assessment designed for you to learn about Moodle's facilities, you are allowed to make multiple attempts at the whole assessment. Click on _'Next' to move to the next screen. Alternatively you may move directly to individual questions by clicking on the corresponding numbers. You may end the assessment at any point by clicking on 'End test...' which will lead you to a Summary page from where you may 'Submit' your answers and finish._ Information screens such as this appear in the Questions panel as an 'i'.

      3. Estimate the gradient of the curve shown in the plot at x = 2. [curved graph of x against y] Click on the answer closest to your estimate.

      4. Question: Solve $$x^2 + 3x - 28 = 0$$

      Enter either of the possible answers.

      Error reading from database

      More information about this error
      Debug info: ERROR: invalid input syntax for integer: ""
      SELECT * FROM core_mdl_files WHERE contextid = $1 AND component = $2 AND filearea = $3 AND itemid = $4 ORDER BY id
      [array (
      0 => '13',
      1 => 'user',
      2 => 'draft',
      3 => '',
      )]
      Stack trace:

      • line 391 of /lib/dml/moodle_database.php: dml_read_exception thrown
      • line 229 of /lib/dml/pgsql_native_moodle_database.php: call to moodle_database->query_end()
      • line 669 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end()
      • line 1075 of /lib/dml/moodle_database.php: call to pgsql_native_moodle_database->get_records_sql()
      • line 1024 of /lib/dml/moodle_database.php: call to moodle_database->get_records_select()
      • line 266 of /lib/filestorage/file_storage.php: call to moodle_database->get_records()
      • line 621 of /lib/filelib.php: call to file_storage->get_area_files()
      • line 215 of /question/type/numerical/questiontype.php: call to file_save_draft_area_files()
      • line 351 of /question/format.php: call to question_numerical_qtype->save_question_options()
      • line 111 of /question/import.php: call to qformat_default->importprocess()
        ----------------------------------------------------------------------------------------------------------------

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              timhunt Tim Hunt
              Reporter:
              mrbriz James Brisland
              Tester:
              Nobody
              Participants:
              Component watchers:
              Tim Hunt, Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Tim Hunt, Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                24/Nov/10