HD Quiz

HDQ_MAX_ANSWERS Creates PHP Warnings

Published: January 19, 2025
Support status: closed

Howdy Dylan, I’ve been looking at the debug log lately and noticed when ever I edit a text based answer on a quiz it produces the following:

[19-Jan-2025 05:17:46 UTC] PHP Warning: Undefined array key 10 in /home/site/hikingadventures/wp-content/plugins/hd-quiz/classes/questions/text-based-answer.php on line 20
[19-Jan-2025 05:17:46 UTC] PHP Warning: Undefined array key 11 in /home/site/hikingadventures/wp-content/plugins/hd-quiz/classes/questions/text-based-answer.php on line 20
[19-Jan-2025 05:17:46 UTC] PHP Warning: Undefined array key 12 in /home/site/hikingadventures/wp-content/plugins/hd-quiz/classes/questions/text-based-answer.php on line 20
[19-Jan-2025 05:17:46 UTC] PHP Warning: Undefined array key 13 in /home/site/hikingadventures/wp-content/plugins/hd-quiz/classes/questions/text-based-answer.php on line 20
[19-Jan-2025 05:17:46 UTC] PHP Warning: Undefined array key 14 in /home/site/hikingadventures/wp-content/plugins/hd-quiz/classes/questions/text-based-answer.php on line 20
[19-Jan-2025 05:17:46 UTC] PHP Warning: Undefined array key 15 in /home/site/hikingadventures/wp-content/plugins/hd-quiz/classes/questions/text-based-answer.php on line 20
[19-Jan-2025 05:17:46 UTC] PHP Warning: Undefined array key 16 in /home/site/hikingadventures/wp-content/plugins/hd-quiz/classes/questions/text-based-answer.php on line 20
[19-Jan-2025 05:17:46 UTC] PHP Warning: Undefined array key 17 in /home/site/hikingadventures/wp-content/plugins/hd-quiz/classes/questions/text-based-answer.php on line 20
[19-Jan-2025 05:17:46 UTC] PHP Warning: Undefined array key 18 in /home/site/hikingadventures/wp-content/plugins/hd-quiz/classes/questions/text-based-answer.php on line 20
[19-Jan-2025 05:17:46 UTC] PHP Warning: Undefined array key 19 in /home/site/hikingadventures/wp-content/plugins/hd-quiz/classes/questions/text-based-answer.php on line 20

When clearing the log, removing from wp-config.php ‘define(‘HDQ_MAX_ANSWERS’, 20);’, followed by editing the question, no error’s appear in the log. If I add the line back, for each new answer possibility a new warning appears (minus the default 10 questions). So if I set the quiz to allow 50 answers, each time I edit a question there appears 40 PHP warnings like the above. I’m using PHP 8.0.30. I’m curious if you see this on your end when defining HDQ_MAX_ANSWERS followed by editing a text based answer. I don’t see the notice on the quiz question edit view but it does show up on the log.

Warm regards,
Josh

thread author: Josh Journey

Hi Josh, I’ll look into this, but for what it’s worth, this is nothing scary or broken. Warnings are not errors, and in this case, doesn’t cause any issues or bugs or anything.

I’ll still need to look into this so that the definition doesn’t clutter up logs for people with debug logs such as yourself.

19 January 2025 — 13:24 support admin - Dylan

Yes, yes. I know from a functionality stand point it doesn’t do anything bad. It would however fill up the log as each question edit can add at least 90 items and if users are editing multiple questions for a single quiz… you could see where this is going. Mainly concerned about filling the log to the point of not being able to see real issues generally from other plugins. 😉

Thanks Dylan for looking into this. I greatly appreciate it.
Warm regards,
Josh

22 January 2025 — 00:48 thread author - Josh Journey

Respond to thread

This thread has been closed / marked as resolved.
You can reply to this thread, but it might be better to start a new thread if you need help
.

You can also upload images to imgur and paste the links here. Just make sure that your images don't include any sensitive information.

Submit