-
Bug
-
Resolution: Fixed
-
Minor
-
None
-
2.9.3
-
MOODLE_29_STABLE
We have a moodle instance 2.9.3 running on PHP 5.6.14 and Postgresql 9.4. Several user fields are synced by LDAP authentication including 'country'. If this field is set to 'Editable if empty' or is locked a user cannot update his profile even if he did no changes at all and to be more precise even with no changes to (the locked) country field.
The update database query fails with "ERROR: value too long for type character varying(2)". The only field in the user table that is configured like this is country.
Trace:
{{[16-Dec-2015 12:42:01 Europe/Berlin] Default exception handler: Fehler beim Schreiben der Datenbank Debug: ERROR: value too long for type character varying(2)
UPDATE mdl_user SET firstname = $1,lastname = $2,email = $3,maildisplay = $4,city = $5,country = $6,timezone = $7,theme = $8,imagealt = $9,firstnamephonetic = $10,lastnamephonetic = $11,middlename = $12,alternatename = $13,url = $14,icq = $15,skype = $16,aim = $17,yahoo = $18,msn = $19,idnumber = $20,institution = $21,department = $22,phone1
= $23,phone2 = $24,address = $25,timemodified = $26,description = $27,descriptionformat = $28 WHERE id=$29
[array (
'firstname' => 'Heide',
'lastname' => 'Witzka',
'email' => 'witzka@hei.de',
'maildisplay' => '2',
'city' => '',
'country' =>
array (
0 => 'DE',
),
'timezone' => '99',
'theme' => '',
'imagealt' => '',
'firstnamephonetic' => '',
'lastnamephonetic' => '',
'middlename' => '',
'alternatename' => '',
'url' => '',
'icq' => '',
'skype' => '',
'aim' => '',
'yahoo' => '',
'msn' => '',
'idnumber' => '12345',
'institution' => 'Da School',
'department' => '',
'phone1' => '',
'phone2' => '',
'address' => '',
'timemodified' => 1450266121,
'description' => 'students',
'descriptionformat' => '1',
0 => 9999,
)]
Error code: dmlwriteexception
line 446 of /lib/dml/moodle_database.php: dml_write_exception thrown
line 244 of /lib/dml/pgsql_native_moodle_database.php: call to moodle_database->query_end()
line 1131 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end()
line 1171 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->update_record_raw()
line 173 of /user/lib.php: call to pgsql_native_moodle_database->update_record() line 230 of /user/edit.php: call to user_update_user()
}}
I did not find out, what value moodle is trying to be set to the country field in the database, as all i could see that this obviously involves another array which first element is 'DE'. This is exactly the value the corresponding field has in the LDAP database, which i double-checked.
We recently moved from Moodle 2.7.x to 2.9.2 followed by 2.9.3. After that a teacher reported the error to me, claiming the error never came up before. However i can't say how often they might be altering their profiles and therefore i would not count on this error being a regression.
However if one leaves 'country' editable in the LDAP authentication plugin, updating the user profile is working flawlessly.
- duplicates
-
MDL-52260 Error editing profile when a profile field is locked
- Closed