Closed AnupamaSarjoshi closed 7 months ago
Thanks Anupama. I'm not sure how an empty sandbox languages comes about, unless by deliberately setting it to empty. It should be filled in from the originating question type before customise was clicked. But your changes are all perfectly safe and do protect against someone deliberately or inadvertently clearing that field.
Hi Richard,
We are seeing the following deprecation warnings on some of our questions. Warning is in the function
answerbox_attributes
, when$currentlanguage
is null anducwords
doesn't accept it.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 749
Have noticed that the questions with these warnings are all using user defined prototype templates (which seems to have been deleted on our systems). But the problem here is when I looked into the database table question_coderunner_options, the language for these user defined prototypes is set to null.
And I suppose, we should never have a user defined prototype template with empty sandbox language. Hence adding a validation to the sandbox language would prevent those issues. Though adding
ucwords($currentlanguage ?? '');
would fix the existing issues as well, I was not sure if that is the right thing to do and thought would be good to confirm before doing that change.Could you please have a look and suggest if I have understood it correctly and the fix is right?
I was able to reproduce this issue with the following steps:
Thanks, Anupama