Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
4.1
-
MOODLE_401_STABLE
-
MOODLE_401_STABLE
-
Description
Found while writing stress tests in MDL-73938
The user authentication filter (see MDL-74453) doesn't add required joins to itself, so when you try to use it in a report that otherwise contains no user columns you get DML exceptions similar to the following:
dmlreadexception
|
Error reading from database
|
File: /lib/dml/moodle_database.php
|
Line: 486
|
Stack trace:
|
|
Unknown column 'u.auth' in 'where clause'
|
|
SELECT COUNT(1)
|
FROM (SELECT c.fullname AS c0_fullname, c.id AS c0_courseid, cctx.id AS c0_ctxid, cctx.path AS c0_ctxpath, cctx.depth AS c0_ctxdepth, cctx.contextlevel AS c0_ctxlevel, cctx.instanceid AS c0_ctxinstance, cctx.locked AS c0_ctxlocked
|
FROM mdl_course c LEFT JOIN mdl_context cctx
|
ON cctx.contextlevel = 50
|
AND cctx.instanceid = c.id
|
WHERE c.id != ? AND (u.auth=?)
|
|
) rbalias41
|
[array (
|
0 => '1',
|
1 => 'ldap',
|
)]
|
Error code: dmlreadexception
|
* line 486 of /lib/dml/moodle_database.php: dml_read_exception thrown
|
* line 291 of /lib/dml/moodle_read_slave_trait.php: call to moodle_database->query_end()
|
* line 1273 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->query_end()
|
* line 1671 of /lib/dml/moodle_database.php: call to mysqli_native_moodle_database->get_records_sql()
|
* line 1744 of /lib/dml/moodle_database.php: call to moodle_database->get_record_sql()
|
* line 1954 of /lib/dml/moodle_database.php: call to moodle_database->get_field_sql()
|
* line 170 of /reportbuilder/classes/table/base_report_table.php: call to moodle_database->count_records_sql()
|
* line 341 of /reportbuilder/classes/table/custom_report_table.php: call to core_reportbuilder\table\base_report_table->query_db()
|
* line 262 of /lib/table/classes/external/dynamic/get.php: call to core_reportbuilder\table\custom_report_table->out()
|
* line 261 of /lib/externallib.php: call to core_table\external\dynamic\get::execute()
|
* line 81 of /lib/ajax/service.php: call to external_api::call_external_function()
|