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

Badges ajax scripts should be managing output and headers in a better way

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Critical Critical
    • 2.5.3
    • 2.5.2, 2.6
    • Badges
    • MOODLE_25_STABLE, MOODLE_26_STABLE
    • MOODLE_25_STABLE
    • MDL-42072_master
    • Hide

      This fix doesn't really fix a bug, but rather improves the way page headers are handled. So, by testing, we just need to make sure that nothing is broken.

      For the first 2 tests, your need to be able to push badges to the backpack (i.e. your web site should be accessible from the Internet). You need a user with any local badge earned and a user backpack connected.

      1. For testing changes in assertion.php: Login as a user and add this issued badge to your Mozilla backpack. Badge should be successfully added to the backpack. Check page headers while adding a badge to make sure that JSON is sent.

      2. For testing changes in backpackconnect.php: Try to connect and disconnect user backpack. Everything should work as before, and if user has a backpack account, it should be connected. It would be difficult to check page headers as the page is reloaded once backpack is connected. But it you can watch the headers while backpack is connecting, check backpackconnect.php for JSON headers.

      3. For testing changes in ajax.php: Login as admin. Go to Site Admin > Badges > Manage Badges. Check your browser for headers sent by ajax.php. Make sure they are of a type JSON.

      I have attached examples of page headers.

      Show
      This fix doesn't really fix a bug, but rather improves the way page headers are handled. So, by testing, we just need to make sure that nothing is broken. For the first 2 tests, your need to be able to push badges to the backpack (i.e. your web site should be accessible from the Internet). You need a user with any local badge earned and a user backpack connected. 1. For testing changes in assertion.php: Login as a user and add this issued badge to your Mozilla backpack. Badge should be successfully added to the backpack. Check page headers while adding a badge to make sure that JSON is sent. 2. For testing changes in backpackconnect.php: Try to connect and disconnect user backpack. Everything should work as before, and if user has a backpack account, it should be connected. It would be difficult to check page headers as the page is reloaded once backpack is connected. But it you can watch the headers while backpack is connecting, check backpackconnect.php for JSON headers. 3. For testing changes in ajax.php: Login as admin. Go to Site Admin > Badges > Manage Badges . Check your browser for headers sent by ajax.php. Make sure they are of a type JSON. I have attached examples of page headers.

      This is an issue that was introduced with MDL-40572

      badges/assertion.php should be managing headers and output better than it currently is.
      Perhaps the easiest way would be to simply define AJAX_SCRIPT at the top of the file, if not then lets copy the headers we need here and define things such that debugging and exception handling is minimised for this script.

        1. headers.png
          headers.png
          144 kB
        2. headers1.png
          headers1.png
          150 kB

            ybozhko Yuliya Bozhko
            samhemelryk Sam Hemelryk
            Frédéric Massart Frédéric Massart
            Sam Hemelryk Sam Hemelryk
            Mark Nelson Mark Nelson
            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.