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

error when creating MC cloze question

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Duplicate
    • Affects Version/s: 2.1
    • Fix Version/s: None
    • Component/s: Questions
    • Labels:
      None
    • Database:
      PostgreSQL
    • Testing Instructions:
      Hide

      In Moodle 1.2, try to create a cloze question like this:

      {1:MC:Madrid~=Berlin~Paris}

      is the capital of Germany.
      When saving it, you will get a "Error reading from database".

      Show
      In Moodle 1.2, try to create a cloze question like this: {1:MC:Madrid~=Berlin~Paris} is the capital of Germany. When saving it, you will get a "Error reading from database".
    • Affected Branches:
      MOODLE_21_STABLE

      Description

      Can't create a multichoice type of cloze question. When saving the question, moodle returns "Error reading from database". With debugging on, it prints:

      Debug info: ERROR: invalid input syntax for integer: "B"
      SELECT * FROM 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 => 'B',
      )]
      Stack trace:

      line 393 of /lib/dml/moodle_database.php: dml_read_exception thrown
      line 232 of /lib/dml/pgsql_native_moodle_database.php: call to moodle_database->query_end()
      line 678 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end()
      line 1111 of /lib/dml/moodle_database.php: call to pgsql_native_moodle_database->get_records_sql()
      line 1060 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 627 of /lib/filelib.php: call to file_storage->get_area_files()
      line 1058 of /question/type/questiontypebase.php: call to file_save_draft_area_files()
      line 85 of /question/type/multichoice/questiontype.php: call to question_type->import_or_save_files()
      line 424 of /question/type/questiontypebase.php: call to qtype_multichoice->save_question_options()
      line 139 of /question/type/multianswer/questiontype.php: call to question_type->save_question()
      line 424 of /question/type/questiontypebase.php: call to qtype_multianswer->save_question_options()
      line 181 of /question/type/multianswer/questiontype.php: call to question_type->save_question()
      line 264 of /question/question.php: call to qtype_multianswer->save_question()

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              timhunt Tim Hunt
              Reporter:
              stencel Przemyslaw Stencel
              Participants:
              Component watchers:
              Tim Hunt, Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: