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

Typo in get_logs_usercourse() - $$coursestart

XMLWordPrintable

    • MOODLE_26_STABLE, MOODLE_27_STABLE, MOODLE_28_STABLE, MOODLE_29_STABLE
    • MOODLE_28_STABLE, MOODLE_29_STABLE
    • MDL-50509-master-vartypo
    • Hide

      Execute a simple test script like this in the Moodle dirroot:

      <?php
       
      define('CLI_SCRIPT', true);
       
      require(__dir__.'/config.php');
       
      $userid = 2;
      $courseid = 1;
      $coursestart = (string)(time() - YEARSECS) . 'foobar';
       
      $logs = get_logs_usercourse($userid, $courseid, $coursestart);
       
      print_object($logs);
      

      You should get an array (empty if there are no relevant records in the log table) and not an exception.

      Show
      Execute a simple test script like this in the Moodle dirroot: <?php   define('CLI_SCRIPT', true);   require(__dir__.'/config.php');   $userid = 2; $courseid = 1; $coursestart = (string)(time() - YEARSECS) . 'foobar';   $logs = get_logs_usercourse($userid, $courseid, $coursestart);   print_object($logs); You should get an array (empty if there are no relevant records in the log table) and not an exception.

      As spotted by Juan Diaz at https://moodle.org/mod/forum/discuss.php?d=314480 there is an obvious typo in the get_logs_usercourse() function:

      $$coursestart = (int)$coursestart;
      

      The line is supposed to read

      $coursestart = (int)$coursestart;
      

      to sanitize the input.

            mudrd8mz David Mudrák (@mudrd8mz)
            mudrd8mz David Mudrák (@mudrd8mz)
            Ankit Agarwal Ankit Agarwal
            Andrew Lyons Andrew Lyons
            Mark Nelson Mark Nelson
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

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