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

Question definition html_to_text incorrectly call format_text on text with urls not rewritten

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 2.4.6, 2.5.2
    • 2.2.9, 2.3.6, 2.4.3
    • Questions
    • MOODLE_22_STABLE, MOODLE_23_STABLE, MOODLE_24_STABLE
    • MOODLE_24_STABLE, MOODLE_25_STABLE
    • Hide

      0. For this test, you need some questions in the question bank with images in the question text.

      1. In the question bank view (question/edit.php) turn on the 'Show question text in the question list' option. Ensure there are no debugging warnings output.

      2. Add your questions to a quiz, and make some attempts as a student.

      3. Go to the statistics report of that quiz, and click thorugh to the detailed analysis for a question with an impage in the question text. Ensure there are no debugging warnings output.

      4. Export your questions from the question bank in XHMTL format. Open the exported file. Ensure that you can see the images.

      5. Export your qusetions as Moodle XML. Re-import them into another course. Ensure there are no debugging warnings output.

      Show
      0. For this test, you need some questions in the question bank with images in the question text. 1. In the question bank view (question/edit.php) turn on the 'Show question text in the question list' option. Ensure there are no debugging warnings output. 2. Add your questions to a quiz, and make some attempts as a student. 3. Go to the statistics report of that quiz, and click thorugh to the detailed analysis for a question with an impage in the question text. Ensure there are no debugging warnings output. 4. Export your questions from the question bank in XHMTL format. Open the exported file. Ensure that you can see the images. 5. Export your qusetions as Moodle XML. Re-import them into another course. Ensure there are no debugging warnings output.

      While testing David patch for MDL-39490 I observed debugger output like:

      Before calling format_text(), the content must be processed with file_rewrite_pluginfile_urls()

      line 1184 of \lib\weblib.php: call to debugging()
      line 302 of \question\type\questionbase.php: call to format_text()
      line 89 of \question\type\match\question.php: call to question_definition->html_to_text()
      line 284 of \question\behaviour\behaviourbase.php: call to qtype_match_question->get_question_summary()
      line 898 of \question\engine\questionattempt.php: call to question_behaviour->get_question_summary()
      line 464 of \question\engine\questionusage.php: call to question_attempt->start()
      line 117 of \question\preview.php: call to question_usage_by_activity->start_question()

      This is related to the function html_to_text in question/type/questionbase.php

      public function html_to_text($text, $format) {
              return html_to_text(format_text($text, $format, array('noclean' => true)), 0, false);
          }
      

      as stated in MDL-39490 it is not correct to call format_text with a text containing non rewritten urls with @@PLUGINFILE@@

            timhunt Tim Hunt
            jmvedrine Jean-Michel Vedrine
            Jean-Michel Vedrine Jean-Michel Vedrine
            Dan Poltawski Dan Poltawski
            Frédéric Massart Frédéric Massart
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.