You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Deprecated: ucwords(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/html/moodle/question/type/coderunner/renderer.php on line 741
#180
We are seeing this notice for some questions, running with PHP 8.1
Deprecated: ucwords(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/html/moodle/question/type/coderunner/renderer.php on line 741
It seems that the code which determines $currentlanguage is getting null, and then ucwords does not like that. Obviously, changing to ucwords($currentlanguage ?? ''); make the notice go away, but that might hide a real issue. @trampgeek, I though I would check with you before changing anything.
(Also, while looking at this, I noticed there were two similar but different chunks of code at
Thanks for checking Tim. Indeed there must be an underlying problem for this to be happening. It implies that either the student's answer or the sample answer is being displayed in an unknown language, which at very least will mean no syntax colouring.
Much of the complexity, and the reason for the two somewhat different bits of code, stems from the multilanguage question type. This was initially a temporary hack but - as they so often do - it stuck around. I'm inclined to suspect the multilanguage question is the cause of the problem you're seeing but I can't immediately see how. Do you have a repeatable scenario that leads to this problem? If not, are you able to confirm please whether anyone in your institution is using multilanguage questions? We never use them ourselves, except for the in-house programming contest question type.
And certainly there is room for some refactoring here. But I'd first like to know what's causing the problem you're seeing.
We are seeing this notice for some questions, running with PHP 8.1
It seems that the code which determines
$currentlanguage
is getting null, and then ucwords does not like that. Obviously, changing toucwords($currentlanguage ?? '');
make the notice go away, but that might hide a real issue. @trampgeek, I though I would check with you before changing anything.(Also, while looking at this, I noticed there were two similar but different chunks of code at
moodle-qtype_coderunner/renderer.php
Line 97 in 7ba87a1
moodle-qtype_coderunner/renderer.php
Line 508 in 7ba87a1
The text was updated successfully, but these errors were encountered: