Uploaded image for project: 'Plugins'
  1. Plugins
  2. CONTRIB-4856

Session variable can be empty when accessed causing PHP warning

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 2.6.1
    • 2.6.3
    • Module: Questionnaire
    • None
    • MOODLE_26_STABLE
    • MOODLE_26_STABLE

    Description

      The $SESSION->questionnaire variable is used in many places without any check that it exists beforehand. This can throw errors when accessing a page through a bookmark for the first time in your browser session.

      For example:

      Log in on browser A, navigate to /mod/questionnaire/report.php

      Copy url to browser B

      • I got to the correct page but there was some warning code at the top:

      Warning: Creating default object from empty value in /vle/www_root/mod/questionnaire/report.php on line 107

      I think this affects new pages: fbsections, fbsettings, and settings as well as existing pages myreport, qsettings, questions, report and show_nonrespondents.

      I'm a bit worried about preview.php which overwrites any existing $SESSION->questionniare with new StdClass(). I don't think it should do that?

      Attachments

        Activity

          People

            rezeau Joseph Rézeau
            jenny-gray Jenny Gray
            Mike Churchward
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              12/May/14