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

count_records_sql does not return an integer

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 2.4
    • 2.2.3, 2.3
    • Database SQL/XMLDB

      The docblock above count_records_sql states that it returns an integer though this is not the case (unless the count is zero in which case an integer will be returned). Here is the current implementation:

      public function count_records_sql($sql, array $params=null) {
          if ($count = $this->get_field_sql($sql, $params)) {
              return $count;
          } else {
              return 0;
          }
      }

      It seems to me that this could be fixed/shorten to:

      public function count_records_sql($sql, array $params=null) {
          return (int)$this->get_field_sql($sql, $params);
      }

            skodak Petr Skoda
            kyledecot Kyle Decot
            Dan Poltawski Dan Poltawski
            Dan Poltawski Dan Poltawski
            Votes:
            1 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.