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

bad use of recordset return value for checking if empty.

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.0.2
    • Component/s: Database SQL/XMLDB
    • Labels:
    • Difficulty:
      Moderate
    • Affected Branches:
      MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE

      Description

      with the changes in 2.0 the following code won't work correctly as recordset calls will always return some data and aren't empty.

      here are just a couple of recordset_sql calls I've found but there are a lot more that need fixing.

      this one looks really bad in lib/dml/moodle_database.php:
      if ($mrs = $this->get_recordset_sql($sql, $params, 0, 1))

      admin/multilangupgrade.php:
      if ($rs = $DB->get_recordset_sql($sql)) {

      course/user.php:
      if (!$rs = $DB->get_recordset_sql($sql)) {

      enrol/authorize/localfuncs.php:
      if (!$rs = $DB->get_recordset_sql($sql)) {

      group/overview.php:
      if ($rs = $DB->get_recordset_sql($sql, $params)) {

      lots like this in lib/accesslib.php:
      if ($rs = $DB->get_recordset_sql($sql, $params)) {

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Votes:
                  0 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    21/Feb/11