From 7c1be89de64a72c86726f2443dc45e0b22b7dc7a Mon Sep 17 00:00:00 2001 From: Richard Lobb Date: Mon, 13 May 2024 19:42:40 +1200 Subject: [PATCH] Prevent PHP warnings when language undefined (probably due to a missing prototype). --- renderer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/renderer.php b/renderer.php index 7de8b646..1904bc73 100644 --- a/renderer.php +++ b/renderer.php @@ -575,7 +575,7 @@ public function correct_response(question_attempt $qa) { } } - $uclang = ucwords($currentlanguage); + $uclang = ucwords($currentlanguage ?? ''); // Current language can be null when prototype missing. $heading = get_string('asolutionis', 'qtype_coderunner'); $heading = substr($heading, 0, strlen($heading) - 1) . ' (' . $uclang . ')'; $divid = 'id_div_' . $fieldname;