Moodle

ADODB fetch association fails in Enrol/Database

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.7
  • Fix Version/s: None
  • Component/s: Enrolments
  • Labels:
    None
  • Environment:
    Informix
  • Affected Branches:
    MOODLE_17_STABLE

Description

In /moodle/enrol/database/enrol.php:

After setting ADODB_FETCH_ASSOC per MDL-7443, the $enroldb's reference of $rs->fields[0] is undefined (at least for the Informix driver), and database enrollment fails. Reference by association works as below.

Changed /moodle/enrol/database/enrol.php 1.27, line 87:
< $courselist[] = $rs->fields[0];

> $courselist[] = $rs->Fields($CFG->enrol_remotecoursefield);

Issue Links

Activity

Hide
Marty Lampard added a comment -

This is also broken with the postgres driver - Also the external authentication module is broken - line 108 and 110 of auth/db/lib.php - simply change to associative array index and the problem is resolved. One wonders how many other places this has been missed???

Show
Marty Lampard added a comment - This is also broken with the postgres driver - Also the external authentication module is broken - line 108 and 110 of auth/db/lib.php - simply change to associative array index and the problem is resolved. One wonders how many other places this has been missed???
Hide
Marty Lampard added a comment -

Here's a patch file to fix both the enrol.php and lib.php files. To patch, change into the moodle root, copy the above file into that directory, then run:
patch -p1 < external_db_associative_array_fix-05dec2006.patch

Good luck...

Show
Marty Lampard added a comment - Here's a patch file to fix both the enrol.php and lib.php files. To patch, change into the moodle root, copy the above file into that directory, then run: patch -p1 < external_db_associative_array_fix-05dec2006.patch Good luck...
Hide
Paul Ortman added a comment -

I can confirm that I'm hitting this issue when using Postgres7 as the database. I independently came up with much the same patch, but only for the enrollment part as I don't use DB based authentication. My patch (just for enrol/database/enrol.php) uses the Fields() function call which seems to be more in-line with how things are done throughout the rest of the file.

Show
Paul Ortman added a comment - I can confirm that I'm hitting this issue when using Postgres7 as the database. I independently came up with much the same patch, but only for the enrollment part as I don't use DB based authentication. My patch (just for enrol/database/enrol.php) uses the Fields() function call which seems to be more in-line with how things are done throughout the rest of the file.
Hide
Paul Ortman added a comment -

Unified patch as in the reported bug.

Show
Paul Ortman added a comment - Unified patch as in the reported bug.
Hide
Martín Langhoff added a comment -

This has been fixed by the fix to MDL-7712.

Show
Martín Langhoff added a comment - This has been fixed by the fix to MDL-7712.

People

Vote (6)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: