• Resolved dev

    (@devksec)


    Hello,

    When using mycred with tutor LMS, we get the following critical error when a student completes a quiz.

    [07-Jan-2025 10:42:14 UTC] PHP Fatal error: Uncaught DivisionByZeroError: Division by zero in /home/SITEPATH/wp-content/plugins/mycred-toolkit/includes/addons/mycred-tutor-lms/includes/mycred-pass-quiz.php:76
    Stack trace: 0 /home/SITEPATH/wp-includes/class-wp-hook.php(326): mycred_tutor_lms_Geneal_Quiz_Hook_Class->my_cred_quiz_pass_func() 1 /home/SITEPATH/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters() 2 /home/SITEPATH/wp-includes/plugin.php(517): WP_Hook->do_action() 3 /home/SITEPATH/wp-content/plugins/tutor/classes/Quiz.php(819): do_action() 4 /home/SITEPATH/wp-content/plugins/tutor/classes/Quiz.php(544): TUTOR\Quiz::manage_attempt_answers() 5 /home/SITEPATH/wp-content/plugins/tutor/classes/Quiz.php(487): TUTOR\Quiz::tutor_quiz_attemp_submit() 6 /home/SITEPATH/wp-includes/class-wp-hook.php(324): TUTOR\Quiz->answering_quiz() 7 /home/SITEPATH/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters() 8 /home/SITEPATH/wp-includes/plugin.php(517): WP_Hook->do_action() 9 /home/SITEPATH/wp-includes/template-loader.php(13): do_action() 10 /home/SITEPATH/wp-blog-header.php(19): require_once(‘/home/SITEPATH/…’) 11 /home/SITEPATH/index.php(17): require(‘/home/SITEPATH/…’) 12 {main}

    thrown in /home/SITEPATH/wp-content/plugins/mycred-toolkit/includes/addons/mycred-tutor-lms/includes/mycred-pass-quiz.php on line 76

    Hooks are setup for both completing and passing a quiz with the default settings.

    However, removing “Passing a Quiz (Tutor LMS)” resolves the issue, which was triggered because the student failed the quiz which isolates the cause.

    If “Passing a Quiz (Tutor LMS)” is enabled but the student fails. the above critical error is caused.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support bukhari10

    (@bukhari10)

    Hello @devksec,

    Thanks for contacting us.

    I hope you are doing well. We have forwarded your query to the appropriate team and will notify you as soon as we receive their response.

    Thanks & Regards
    WPExperts Support Team.

    Plugin Support bukhari10

    (@bukhari10)

    Hello @devksec,

    Thanks for contacting us,

    Please confirm which version of myCred, PHP, and WordPress you are using. We tested it with myCred 2.8 version/myCred 2.9 version and myCred toolkit. We did not encounter this error. It worked correctly, and the respective user was rewarded with points.

    Thank you.

    Thread Starter dev

    (@devksec)

    Hello,

    Version details are:
    WordPress
    PHP v 8.2.26
    Mycred Version 2.9
    Mycred Toolkit Version 1.1.0 
    LMS Pro 3.1.0 

    This is only with the “Passing a Quiz (Tutor LMS)” hook when a student fails a test.

    Plugin Support bukhari10

    (@bukhari10)

    Hello @devksec,

    Also, we noticed that this issue occurred when the ‘Point For This Question’ value was 0. We have fixed this issue for all scenarios. You can use this updated version of the plugin. https://ibb.co/YTGLjc4

    Please find attached the updated myCred Toolkit plugin for your reference.
    Here is the Plugin: https://drive.google.com/file/d/1vyoQGRosHTR53NIdFIiW_HpDuxSx7Jp5/view?usp=sharing

    If you have any further queries, please feel free to ask.

    Thank you.

    Thread Starter dev

    (@devksec)

    Great, will test that out.

    Will this fix be included in the next release?

    Plugin Support bukhari10

    (@bukhari10)

    Hi @devksec,

    Sure! This will be included in the next plugin release.

    Thank you.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘PHP Fatal error: Uncaught DivisionByZeroError: Division by zero in’ is closed to new replies.