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

get_records*_sql silently converts invalid limit param to integer

XMLWordPrintable

    • 13
    • BACKEND Sprint 8

      The parameters for get_records are:

      get_records($table, array $conditions=null, $sort='', $fields='*', $limitfrom=0, $limitnum=0)
      

      The parameters for get_records_sql are:

      get_records_sql($sql, array $params=null, $limitfrom=0, $limitnum=0);
      

      Note that if you are a silly developer like Dan, you might accidentally pass a sort to $limitfrom.

      In that case, Moodle silently converts the string to an int without warning the developer. I propose to add a debugdeveloper warning for this.

            poltawski Dan Poltawski
            poltawski Dan Poltawski
            Tim Hunt Tim Hunt
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Michael de Raadt Michael de Raadt
            Votes:
            1 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.