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

Use of getallheaders() causes problems with outcomes feature of external tools when working on IIS

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • None
    • 2.2.2
    • LTI External tool

      When using the grade reporting feature of IMS-LTI on a non-Apache server environment, there is an issue with the use of the getallheaders() function. When attmepting to use outcome functionality with the test tool provider located at http://www.imsglobal.org/developers/LTI/test/v1p1/tool.php
      an error occurs in mod/lti/service.php.
      According to http://us2.php.net/manual/en/function.getallheaders.php the getallheaders function, which service.php uses, is only supported on Apache.
      A workaround was defining the function if it doesn't already exist.

      Steps to reproduce:

      1. Install Moodle on IIS (though any non-Apache server would also likely cause this)
      2. Create a new external tool activity linking to http://www.imsglobal.org/developers/LTI/test/v1p1/tool.php
      3. Save and display the activity
      4. Navigate to the LIS/LTI Outcome Service
      5. Attempt any of the functions - service.php will error out (or no result is returned)

      Potential Solution/Workaround:
      Added the following to servicelib.php (solution found in comments on php documentation):

      if (!function_exists('getallheaders')) 
      {
          function getallheaders() 
          {
             foreach ($_SERVER as $name => $value) 
             {
                 if (substr($name, 0, 5) == 'HTTP_') 
                 {
                     $headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value;
                 }
             }
             return $headers;
          }
      }

            bushido Mark Nielsen (Inactive)
            jkhan Jamil Khan
            Dan Poltawski Dan Poltawski
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

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