moodleou / moodle-mod_forumng

ForumNG forum module for Moodle
19 stars 20 forks source link

2.8 - Student view fails #44

Closed aspark21 closed 9 years ago

aspark21 commented 9 years ago

Moodle 2.8 Stable ForumNG lastest DB MariaDB 10.0.x

We are getting this error when trying to view a forumng discussion board but only when logged in as a student, as an admin this loads fine.

Any ideas?

Debug info: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'read FROM mdl_forumng_posts fp INNER JOIN mdl_user u ON fp.userid = u.id' at line 10

SELECT fp.*, u.id as u_id,u.username as u_username,u.picture as u_picture,u.url as u_url,u.imagealt as u_imagealt,u.email as u_email,u.maildisplay as u_maildisplay,u.mailformat as u_mailformat,u.maildigest as u_maildigest,u.emailstop as u_emailstop,u.deleted as u_deleted,u.auth as u_auth,u.timezone as u_timezone,u.lang as u_lang,u.idnumber as u_idnumber,u.firstnamephonetic as u_firstnamephonetic,u.lastnamephonetic as u_lastnamephonetic,u.middlename as u_middlename,u.alternatename as u_alternatename,u.firstname as u_firstname,u.lastname as u_lastname, eu.id as eu_id,eu.username as eu_username,eu.picture as eu_picture,eu.url as eu_url,eu.imagealt as eu_imagealt,eu.idnumber as eu_idnumber,eu.email as eu_email,eu.firstnamephonetic as eu_firstnamephonetic,eu.lastnamephonetic as eu_lastnamephonetic,eu.middlename as eu_middlename,eu.alternatename as eu_alternatename,eu.firstname as eu_firstname,eu.lastname as eu_lastname, du.id as du_id,du.username as du_username,du.picture as du_picture,du.url as du_url,du.imagealt as du_imagealt,du.idnumber as du_idnumber,du.email as du_email,du.firstnamephonetic as du_firstnamephonetic,du.lastnamephonetic as du_lastnamephonetic,du.middlename as du_middlename,du.alternatename as du_alternatename,du.firstname as du_firstname,du.lastname as du_lastname

, ff.flagged

, fr.time AS read FROM mdl_forumng_posts fp INNER JOIN mdl_user u ON fp.userid = u.id LEFT JOIN mdl_user eu ON fp.edituserid = eu.id LEFT JOIN mdl_user du ON fp.deleteuserid = du.id

LEFT JOIN mdl_forumng_flags ff ON ff.postid = fp.id AND ff.userid = ?

LEFT JOIN mdl_forumng_read_posts fr ON fr.postid = fp.id AND fr.userid = ? WHERE fp.discussionid=? AND fp.oldversion=0 ORDER BY fp.created

[array ( 0 => '19679', 1 => '19679', 2 => '3601', )] Error code: dmlreadexception Stack trace: · line 443 of /lib/dml/moodle_database.php: dml_read_exception thrown · line 1080 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end() · line 1036 of /mod/forumng/mod_forumng_post.php: call to mysqli_native_moodle_database->get_records_sql() · line 661 of /mod/forumng/mod_forumng_discussion.php: call to mod_forumng_post::query_posts() · line 41 of /mod/forumng/renderer.php: call to mod_forumng_discussion->get_root_post() · line 290 of /mod/forumng/type/general/forumngtype_general.php: call to mod_forumng_renderer->render_discussion() · line 104 of /mod/forumng/discuss.php: call to forumngtype_general->print_discussion_page()

aspark21 commented 9 years ago

N.B: This does work under MySQL 5.5.41 (dev) but not under MariaDB 10.0.17 (prod)

aspark21 commented 9 years ago

This issue is only getting weirder as not only did it appear to only affect 1 db type, it turns out it only affects 3 users.

From the SQL query I figured it could be something to do with the data in the profile fields potentially causing this. There was 1 thing which did stand out with the 1st user - description, imagealt, lastnamephonetic, firstnamephonetic, middlename, alternatename all had empty values where all other accounts had 'NULL' values. Updating this to 'NULL' for the user did not resolve the issue and other accounts with empty values in those fields do not encounter this error. However the second user affected (which we discovered later after this) does not have this characteristic (NULL values present) so I think we can rule this out.

The few accounts affected do seem to be international users (non-UK), could it be caused by an encoding issue?

I'll keep digging...

jason-platts commented 9 years ago

Should be fixed by update in #47 when that goes upstream