Affects Version/s: 1.8.5, 1.8.6, 1.8.7, 1.9, 1.9.1, 1.9.2, 1.9.3
Affected Branches:MOODLE_18_STABLE, MOODLE_19_STABLE
Fixed Branches:MOODLE_18_STABLE, MOODLE_19_STABLE
Environment: a new LDAP entry try to authenticate for the first time in Moodle and still there isn't a record in mdl_user table.
When this new user try to authenticate, authenticate_user_login function is called. If the credentials are correct, it search the correct record in mdl_user table without success and it calls create_user_record.
This function try to create a new record, but this is the error message:
Field 'city' doesn't have a default value
INSERT INTO mdl_user ( AUTH, CONFIRMED, MNETHOSTID, USERNAME, FIRSTNAME, LASTNAME, LANG, LASTIP, TIMEMODIFIED ) VALUES ( 'ldap', 1, 1, 'd.eliseo', 'Donato', 'Eliseo', 'it_utf8', '10.250.1.21', 1229596730 )
line 1425 of lib/dmllib.php: call to debugging()
line 2603 of lib/moodlelib.php: call to insert_record()
line 2787 of lib/moodlelib.php: call to create_user_record()
line 126 of login/form.php: call to authenticate_user_login()
infact City Field is a nonull param as you see in cvs:/lib/db/install.xml without default value
Solution: adding something like:
$newuser->city = '';
in create_user_record function in cvs:/lib/moodlelib.php