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

Incorrect require_login test in questionlib

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 2.2.7, 2.3.4, 2.4
    • 2.3.3
    • Questions, Quiz
    • None
    • MOODLE_23_STABLE
    • MOODLE_22_STABLE, MOODLE_23_STABLE, MOODLE_24_STABLE
    • Hide

      1. As admin, Create some questions with images in various places like the questiontext, generalfeedback, etc.

      2. Create them in different areas of the question bank. That is in the question categories for system, course category, course CF100, and a Quiz1 in course CF100. (So, that is 4 questions.)

      3. Preview all 4 questions, and make sure you can see the images.

      4. Add those questions to Quiz1.

      5. Now log in as teacher t1, who is enrolled as a teacher in course CF100. You will only be able to preview two of the questions. Do that, and make sure you can see all the images.

      6. Preview the quiz. You should be able to see all four questions, including the images. (Of course, you will have to submit to see them all.)

      7. Now log in as student s1, who is enrolled in course CF100. Attempt the quiz. You should be able to see all four questions, including the images.

      8. Open each image on the review page in a separate tab. (In Firefox, right click on the image, then hold down CTRL and click View image.)

      9. Disable s1's enrolment in CF100. Re-load each image. You should get a permission denied error.

      10. Logged in as teacher t1 again, go to Quiz1 -> results -> Statistics in the navigation block. Click on the name of each question, and make sure you can see the images in the question text.

      11. Look in the PHP logs, and make sure there are no errors like the one in this issue's description.

      Show
      1. As admin, Create some questions with images in various places like the questiontext, generalfeedback, etc. 2. Create them in different areas of the question bank. That is in the question categories for system, course category, course CF100, and a Quiz1 in course CF100. (So, that is 4 questions.) 3. Preview all 4 questions, and make sure you can see the images. 4. Add those questions to Quiz1. 5. Now log in as teacher t1, who is enrolled as a teacher in course CF100. You will only be able to preview two of the questions. Do that, and make sure you can see all the images. 6. Preview the quiz. You should be able to see all four questions, including the images. (Of course, you will have to submit to see them all.) 7. Now log in as student s1, who is enrolled in course CF100. Attempt the quiz. You should be able to see all four questions, including the images. 8. Open each image on the review page in a separate tab. (In Firefox, right click on the image, then hold down CTRL and click View image.) 9. Disable s1's enrolment in CF100. Re-load each image. You should get a permission denied error. 10. Logged in as teacher t1 again, go to Quiz1 -> results -> Statistics in the navigation block. Click on the name of each question, and make sure you can see the images in the question text. 11. Look in the PHP logs, and make sure there are no errors like the one in this issue's description.

      question_preview_question_pluginfile contains a require_login test using a cmid guessed from a contextid in the URL. However, this is not always correct. Functions like quiz_question_pluginfile later do the correct require_login call, and that leads to errors like

      .../php-logs/php.log.5:[18-Nov-2012 20:32:48 Europe/London] PHP Notice: Coding problem: unsupported modification of PAGE->context from 70 to 70

      • line 788 of /lib/pagelib.php: call to debugging()
      • line 830 of /lib/pagelib.php: call to moodle_page->set_context()
      • line 2653 of /lib/moodlelib.php: call to moodle_page->set_cm()
      • line 1729 of /mod/quiz/lib.php: call to require_login()
      • line 1855 of /lib/questionlib.php: call to mod_quiz_question_pluginfile()
      • line 3833 of /lib/filelib.php: call to question_pluginfile()
      • line 37 of /pluginfile.php: call to file_pluginfile()
        in /vle/www_root/lib/weblib.php on line 2751

            timhunt Tim Hunt
            timhunt Tim Hunt
            Dan Poltawski Dan Poltawski
            Rossiani Wijaya Rossiani Wijaya
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

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