diff --git a/admin/tool/uploaduser/index.php b/admin/tool/uploaduser/index.php index f249f1dd9ca..afbc37042df 100644 --- a/admin/tool/uploaduser/index.php +++ b/admin/tool/uploaduser/index.php @@ -535,6 +535,7 @@ if ($formdata = $mform2->is_cancelled()) { } if (!property_exists($user, $column) or !property_exists($existinguser, $column)) { // this should never happen + debugging("Could not find $column on the user objects", DEBUG_DEVELOPER); continue; } if ($updatetype == UU_UPDATE_MISSING) { diff --git a/enrol/manual/locallib.php b/enrol/manual/locallib.php index a96935429e9..16ad4a2a92e 100644 --- a/enrol/manual/locallib.php +++ b/enrol/manual/locallib.php @@ -406,6 +406,7 @@ function enrol_manual_migrate_plugin_enrolments($enrol) { if (!$minstance) { // This should never happen unless adding of default instance fails unexpectedly. + debugging('Failed to find manual enrolment instance', DEBUG_DEVELOPER); continue; } diff --git a/grade/edit/outcome/index.php b/grade/edit/outcome/index.php index c1d9b5b54a8..658d5cea936 100644 --- a/grade/edit/outcome/index.php +++ b/grade/edit/outcome/index.php @@ -132,6 +132,7 @@ if ($courseid and $outcomes = grade_outcome::fetch_all_local($courseid)) { $scale = $outcome->load_scale(); if (empty($scale->id)) { // hopefully never happens $line[] = $scale->get_name(); + debugging("Found a scale with no ID ({$scale->get_name()}) while outputting course outcomes", DEBUG_DEVELOPER); } else { if (empty($scale->courseid)) { $caneditthisscale = $caneditsystemscales; @@ -181,6 +182,7 @@ if ($outcomes = grade_outcome::fetch_all_global()) { $scale = $outcome->load_scale(); if (empty($scale->id)) { // hopefully never happens $line[] = $scale->get_name(); + debugging("Found a scale with no ID ({$scale->get_name()}) while outputting global outcomes", DEBUG_DEVELOPER); } else { if (empty($scale->courseid)) { $caneditthisscale = $caneditsystemscales; diff --git a/lib/accesslib.php b/lib/accesslib.php index c6d7f2c976b..5a59ea61bab 100644 --- a/lib/accesslib.php +++ b/lib/accesslib.php @@ -393,6 +393,7 @@ function has_capability($capability, context $context, $user = null, $doanything if (!isset($USER->id)) { // should never happen $USER->id = 0; + debugging('Capability check being performed on a user with no ID.', DEBUG_DEVELOPER); } // make sure there is a real user specified @@ -2062,6 +2063,7 @@ function can_access_course(stdClass $course, $user = null, $withcapability = '', if (!isset($USER->id)) { // should never happen $USER->id = 0; + debugging('Course access check being performed on a user with no ID.', DEBUG_DEVELOPER); } // make sure there is a user specified diff --git a/lib/datalib.php b/lib/datalib.php index a1e5ab95520..f54eae6f898 100644 --- a/lib/datalib.php +++ b/lib/datalib.php @@ -57,7 +57,9 @@ function get_admin() { static $mainadmin = null; static $prevadmins = null; - if (empty($CFG->siteadmins)) { // Should not happen on an ordinary site. + if (empty($CFG->siteadmins)) { + // Should not happen on an ordinary site. + // It does however happen during unit tests. return false; }