Issue Details (XML | Word | Printable)

Key: MDL-7655
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Minor Minor
Assignee: Martín Langhoff
Reporter: Clinton Graham
Votes: 6
Watchers: 1
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Moodle

ADODB fetch association fails in Enrol/Database

Created: 22/Nov/06 10:20 PM   Updated: 05/Mar/07 08:43 AM
Component/s: Enrolments
Affects Version/s: 1.7
Fix Version/s: None

File Attachments: 1. Text File enrol.php.patch (0.5 kB)
2. Text File external_db_associative_array_fix-05dec2006.patch (2 kB)

Environment: Informix
Issue Links:
Dependency
 

Participants: Clinton Graham, Marty Lampard, Martín Langhoff and Paul Ortman
Security Level: None
QA Assignee: Eloy Lafuente (stronk7)
Resolved date: 05/Mar/07
Affected Branches: MOODLE_17_STABLE


 Description  « Hide
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);



 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Marty Lampard added a comment - 06/Dec/06 04:15 AM
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???

Marty Lampard added a comment - 06/Dec/06 04:47 AM
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...


Paul Ortman added a comment - 05/Jan/07 10:54 PM
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.

Paul Ortman added a comment - 05/Jan/07 10:56 PM
Unified patch as in the reported bug.

Martín Langhoff added a comment - 05/Mar/07 08:43 AM
This has been fixed by the fix to MDL-7712.