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

Call to a member function FetchRow on a non-object in get_user_access_sitewide

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9, 2.0
    • Fix Version/s: 1.9, 2.0
    • Component/s: Database SQL/XMLDB
    • Labels:
      None
    • Environment:
      PostgreSQL 8.x
    • Database:
      Any
    • Affected Branches:
      MOODLE_19_STABLE, MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE, MOODLE_20_STABLE

      Description

      We (OU) get the following error, during upgrade from 1.8+ to 1.9 Beta 2,
      " PHP Fatal error: Call to a member function FetchRow() on a non-object in /xxx/www_root/lib/dmllib.php on line 919 "

      A look at the stack-trace shows this originates around line 1275 of lib/accesslib.php, in get_user_access_sitewide function - the returned recordset $rs is null. I suggest we should be checking $rs, before de-referencing, for example:

      $rs = get_recordset('SELECT .....');
      if ($rs) {
      while ($rec = rs_fetch_next_record($rs))

      { /// Perform actions with the $rec record here }

      rs_close($rs);
      }

        Attachments

          Activity

            People

            • Assignee:
              nfreear Nick Freear
              Reporter:
              nfreear Nick Freear
              Tester:
              Nobody
              Participants:
              Component watchers:
              Jake Dallimore, Jun Pataleta, Ryan Wyllie
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                3/Mar/08