tecnickcom / tcexam

TCExam is a CBA (Computer-Based Assessment) system (e-exam, CBT - Computer Based Testing) for universities, schools and companies, that enables educators and trainers to author, schedule, deliver, and report on surveys, quizzes, tests and exams.
http://www.tcexam.org
Other
564 stars 400 forks source link

Php 8.2 deprecation warnings populating explanation boxes for multiple choices answers #417

Open lectrical opened 9 months ago

lectrical commented 9 months ago

Describe the bug

Running on a Debian Bookworm server with nginx 1.22.1 and php-fpm 8.2. I kept seeing depreciated warnings that were visible in the rendering of the page. I believe these were mostly resolved with the use of this in my php.ini

error_reporting = E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED & ~E_STRICT & ~E_NOTICE

This resolved me seeing the following explanation box warnings showing as the explanation on this the list page.

It did not fix the main annoyance of the error being automatically generated into the explanation box for multiple choice questions.

image

Every new answer will have this warning automatically entered into the explanation box until i manually enter some text. Without the php.ini settings it will also be visible in the list section as the text of the explanation.

[!NOTE] By following this https://stackoverflow.com/a/71719307 and doing this for all instances of htmlspecialchars in the /admin/code/tce_edit_answer.php and /admin/code/tce_edit_question.php I was able to prevent the warning from populating the explanation box

   echo '>' . htmlspecialchars($answer_explanation ?? '', ENT_NOQUOTES, $l['a_meta_charset']) . '</textarea>' . K_NEWLINE;

I don't assume this is an elegant solution because it's not solving the problem of why the text is populated into that box in the first place but resolving the deprecation warnings which is effectively masking the bug and lets me carry on in the meantime.

To Reproduce Steps to reproduce the behavior:

Install tcexam on linux/debian bookworm with nginx 1.22.1 and php-fpm 8.2

Expected behavior

Not have the answer explanation box text auto populated with the depreciation warning.

Logs

I figure this is not so helpful as we know the warnings are valid, it's just not meant to populate that box?

Environment:

Additional context Add any other context about the problem here.

nicolaasuni commented 9 months ago

Are you using the latest TCExam version?

lectrical commented 9 months ago

@nicolaasuni I git cloned the repo and as there is only a main branch/no releases would say yes, that is the current source?

git clone https://github.com/tecnickcom/tcexam.git

Also, still see some warnings in the UI, like tce_edit_user.php but not others.

Agunechemba commented 9 months ago

Yes

On Wed, 3 Jan 2024 12:22 Nicola Asuni, @.***> wrote:

Are you using the latest TCExam version?

— Reply to this email directly, view it on GitHub https://github.com/tecnickcom/tcexam/issues/417#issuecomment-1875212901, or unsubscribe https://github.com/notifications/unsubscribe-auth/AX3OT7GJJLWPK5DEWRRXWXLYMU5NRAVCNFSM6AAAAABBKELHNGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZVGIYTEOJQGE . You are receiving this because you are subscribed to this thread.Message ID: @.***>