-
Bug
-
Resolution: Fixed
-
Minor
-
2.3
-
MOODLE_23_STABLE
-
MOODLE_21_STABLE, MOODLE_22_STABLE
-
MDL-33194-master
If you attempt to subscribe another user to a forum you produce the following stack trace:
Debug info: Column 'userid' cannot be null
INSERT INTO mdl_forum_subscriptions (userid,forum) VALUES(?,?)
[array (
0 => NULL,
1 => '2',
)]
Error code: dmlwriteexception
Stack trace:
line 416 of /lib/dml/moodle_database.php: dml_write_exception thrown
line 952 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
line 994 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->insert_record_raw()
line 4560 of /mod/forum/lib.php: call to mysqli_native_moodle_database->insert_record()
line 170 of /mod/forum/subscribe.php: call to forum_subscribe()
Output buffer: <br /> <b>Notice</b>: Undefined property: stdClass::$id in <b>/html/mod/forum/subscribe.php</b> on line <b>134</b><br /> <br /> <b>Notice</b>: Undefined property: stdClass::$id in <b>/html/mod/forum/subscribe.php</b> on line <b>170</b><br />
The $DB->get_record() call on line 65 includes only three parameters, so it never returns any fields. I'm not sure how to actually reach this code via the interface; I noticed the function call and worked backwards to produce the stack trace.