Dear @korynorthrop ,
Hope you are doing well.
Can you please share the website link and the plugin version you are using right now.
Looking forward to your reply.
Regards,
Sumit
Thank you @sumitsanadhya. The website and example page that uses a QSM shortcode is here. We’re using version 8.1.14.
Dear @korynorthrop ,
Thank you for your patience on this issue.
We have implemented two changes in our code:
- In the file path /…/wp-content/plugins/quiz-master-next/php/template-variables.php on line 386:
Modified
$quiz_questions = !empty( $quiz_settings[‘pages’] ) ? maybe_unserialize( $quiz_settings[‘pages’] ) : array();
- In the file path /…/wp-content/plugins/quiz-master-next/php/classes/class-qmn-quiz-manager.php on line 451:
Modified
$correct_answer_logic = !empty( $quiz_options[‘correct_answer_logic’] ) ? $quiz_options[‘correct_answer_logic’] : ”;
You can make the same changes in your code and test whether this bug is fixed or not.
Looking forward to your reply.
Regards,
Sumit
Thank you for the reply @sumitsanadhya. Those are the same changes I already made and they do not fix the problem. I still get the same error message, “There has been a critical error on this website. Please check your site admin email inbox for instructions.” I even tried on a fresh install of version 8.1.14 of your plugin.
Dear @korynorthrop
Thank you for sharing the details.
Let me discuss this with our technical team. Can you please share the error /debug log of your website.
That will help us to troubleshoot the issue.
Regards,
Sumit
Can I upload/send it to you somehow? I don’t want to post it on this forum since it has server information in it.
Dear @korynorthrop ,
We have tried to attempt to recreate the problem using the details you specified system environment, including WordPress 6.3 and PHP 8.1.22 (we tested up to 8.1). However, We are unable to reproduce the problem. Since the provided solution in the previous comment addressed the errors but they remain unresolved, it suggests a potential version compatibility problem.
Therefore, we recommend downgrading the PHP version and testing whether the error is resolved or not.
Looking forward to your reply.
Regards,
Sumit
@sumitsanadhya thanks for your reply. Well, from my perspective it still seems like a QSM issue. When I disable all other plugins, enable the default 2023 WordPress theme, and activate your plugin, I get the critical error. When your plugin is disabled it goes away. There are no other plugins activated and no customizations on the theme. So, really there’s nothing else I can point to except your plugin being the cause of the error. So how can we move forward?
[ Please do not bump. ]
Dear @korynorthrop ,
We are still working on this issue. I will keep you posted with further updates soon.
Regards,
Sumit
Dear @korynorthrop,
We are still not able to reproduce this issue on our end.
Can you kindly furnish us with the debug.log file? This would be greatly beneficial. The file can be located in the wp-content folder. Please delete the existing debug.log file and then reattempt the process where the error is encountered. Following that, you should review and forward the new debug.log file here.
In the event that the debug.log file is not present, you can follow the instruction given in the below link.
Debugging in WordPress
Looking forward to your reply.
Regards,
Sumit
Thank you for your reply. Below is the fresh debug.log output. I removed our actual server path for security purposes.
[08-Sep-2023 16:29:24 UTC] WordPress database error Duplicate entry '' for key 'unique_id' for query ALTER TABLE wp_mlw_results ADD UNIQUE (unique_id) made by require_once('wp-admin/admin.php'), do_action('admin_init'), WP_Hook->do_action, WP_Hook->apply_filters, QSM_Install->update[08-Sep-2023 16:29:24 UTC] PHP Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /real-path/removed/forsecuritypurposes.com/wp-content/plugins/quiz-master-next/php/classes/class-qsm-migrate.php:148Stack trace:#0 /real-path/removed/forsecuritypurposes.com/wp-content/plugins/quiz-master-next/php/classes/class-qsm-install.php(2161): QSM_Migrate::fix_duplicate_questions()#1 /real-path/removed/forsecuritypurposes.com/wp-includes/class-wp-hook.php(310): QSM_Install->update()#2 /real-path/removed/forsecuritypurposes.com/wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters()#3 /real-path/removed/forsecuritypurposes.com/wp-includes/plugin.php(517): WP_Hook->do_action()#4 /real-path/removed/forsecuritypurposes.com/wp-admin/admin.php(175): do_action()#5 /real-path/removed/forsecuritypurposes.com/wp-admin/plugins.php(10): require_once('/homepages/24/d...')#6 {main} thrown in /real-path/removed/forsecuritypurposes.com/wp-content/plugins/quiz-master-next/php/classes/class-qsm-migrate.php on line 148[08-Sep-2023 16:29:31 UTC] WordPress database error Duplicate entry '' for key 'unique_id' for query ALTER TABLE wp_mlw_results ADD UNIQUE (unique_id) made by require_once('wp-admin/admin.php'), do_action('admin_init'), WP_Hook->do_action, WP_Hook->apply_filters, QSM_Install->update[08-Sep-2023 16:29:31 UTC] PHP Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /real-path/removed/forsecuritypurposes.com/wp-content/plugins/quiz-master-next/php/classes/class-qsm-migrate.php:148Stack trace:#0 /real-path/removed/forsecuritypurposes.com/wp-content/plugins/quiz-master-next/php/classes/class-qsm-install.php(2161): QSM_Migrate::fix_duplicate_questions()#1 /real-path/removed/forsecuritypurposes.com/wp-includes/class-wp-hook.php(310): QSM_Install->update()#2 /real-path/removed/forsecuritypurposes.com/wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters()#3 /real-path/removed/forsecuritypurposes.com/wp-includes/plugin.php(517): WP_Hook->do_action()#4 /real-path/removed/forsecuritypurposes.com/wp-admin/admin.php(175): do_action()#5 /real-path/removed/forsecuritypurposes.com/wp-admin/plugins.php(10): require_once('/homepages/24/d...')#6 {main} thrown in /real-path/removed/forsecuritypurposes.com/wp-content/plugins/quiz-master-next/php/classes/class-qsm-migrate.php on line 148[08-Sep-2023 16:29:55 UTC] WordPress database error Duplicate entry '' for key 'unique_id' for query ALTER TABLE wp_mlw_results ADD UNIQUE (unique_id) made by require_once('wp-admin/admin.php'), do_action('admin_init'), WP_Hook->do_action, WP_Hook->apply_filters, QSM_Install->update[08-Sep-2023 16:29:55 UTC] PHP Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /real-path/removed/forsecuritypurposes.com/wp-content/plugins/quiz-master-next/php/classes/class-qsm-migrate.php:148Stack trace:#0 /real-path/removed/forsecuritypurposes.com/wp-content/plugins/quiz-master-next/php/classes/class-qsm-install.php(2161): QSM_Migrate::fix_duplicate_questions()#1 /real-path/removed/forsecuritypurposes.com/wp-includes/class-wp-hook.php(310): QSM_Install->update()#2 /real-path/removed/forsecuritypurposes.com/wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters()#3 /real-path/removed/forsecuritypurposes.com/wp-includes/plugin.php(517): WP_Hook->do_action()#4 /real-path/removed/forsecuritypurposes.com/wp-admin/admin.php(175): do_action()#5 /real-path/removed/forsecuritypurposes.com/wp-admin/index.php(10): require_once('/homepages/24/d...')#6 {main} thrown in /real-path/removed/forsecuritypurposes.com/wp-content/plugins/quiz-master-next/php/classes/class-qsm-migrate.php on line 148[08-Sep-2023 16:29:57 UTC] WordPress database error Duplicate entry '' for key 'unique_id' for query ALTER TABLE wp_mlw_results ADD UNIQUE (unique_id) made by require_once('wp-admin/admin.php'), do_action('admin_init'), WP_Hook->do_action, WP_Hook->apply_filters, QSM_Install->update[08-Sep-2023 16:29:57 UTC] PHP Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /real-path/removed/forsecuritypurposes.com/wp-content/plugins/quiz-master-next/php/classes/class-qsm-migrate.php:148Stack trace:#0 /real-path/removed/forsecuritypurposes.com/wp-content/plugins/quiz-master-next/php/classes/class-qsm-install.php(2161): QSM_Migrate::fix_duplicate_questions()#1 /real-path/removed/forsecuritypurposes.com/wp-includes/class-wp-hook.php(310): QSM_Install->update()#2 /real-path/removed/forsecuritypurposes.com/wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters()#3 /real-path/removed/forsecuritypurposes.com/wp-includes/plugin.php(517): WP_Hook->do_action()#4 /real-path/removed/forsecuritypurposes.com/wp-admin/admin.php(175): do_action()#5 /real-path/removed/forsecuritypurposes.com/wp-admin/index.php(10): require_once('/homepages/24/d...')#6 {main} thrown in /real-path/removed/forsecuritypurposes.com/wp-content/plugins/quiz-master-next/php/classes/class-qsm-migrate.php on line 148
Dear @korynorthrop ,
Thank you for the debug log. Our technical team is working on it.
I will keep you posted with further updates soon.
Regards,
Sumit
Dear @korynorthrop ,
We have tested again with fresh installation but there is no such issue found.
But according to debug log provided by you I will suggest a code to add in the functions.php file.
Here is the details for your reference.
File path ➝ wp-content\plugins\quiz-master-next\php\admin\functions.php
Code➝ add_option( ‘fixed_duplicate_questions’, ‘1’ );
I request you to please add this code before activation, check if it is working or not working then let me know.
Regards,
Sumit
@sumitsanadhya it seems that updating the QSM plugin to version 8.1.15 and adding your code snippet to the functions.php file worked. I successfully activated the QSM plugin without getting the critical error. I am able to access WP Admin while your plugin is active and I was able to take a quiz on the front-end.
What does that code snippet do, exactly?
I also want to let you now that there still are some PHP warnings related to your plugin that I see in our debug.log
[14-Sep-2023 16:05:08 UTC] WordPress database error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 3 for query SELECT quiz_id, question_id, answer_array, question_answer_info, question_type_new, question_settings
FROM wp_mlw_questions
WHERE question_id IN () made by require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/twentytwelve/page.php'), get_template_part, locate_template, load_template, require('/themes/twentytwelve/content-page.php'), the_content, apply_filters('the_content'), WP_Hook->apply_filters, do_shortcode, preg_replace_callback, do_shortcode_tag, QMNQuizManager->display_shortcode
[14-Sep-2023 16:05:38 UTC] PHP Warning: Undefined array key "type" in /path-to/our-website.com/wp-content/plugins/quiz-master-next/php/classes/class-qmn-plugin-helper.php on line 1046
[14-Sep-2023 16:05:38 UTC] PHP Warning: Undefined array key "type" in /path-to/our-website.com/wp-content/plugins/quiz-master-next/php/classes/class-qmn-plugin-helper.php on line 1046
[14-Sep-2023 16:05:38 UTC] PHP Warning: Undefined array key "type" in /path-to/our-website.com/wp-content/plugins/quiz-master-next/php/classes/class-qmn-plugin-helper.php on line 1046
[14-Sep-2023 16:05:38 UTC] PHP Warning: Undefined array key "type" in /path-to/our-website.com/wp-content/plugins/quiz-master-next/php/classes/class-qmn-plugin-helper.php on line 1046
[14-Sep-2023 16:06:34 UTC] WordPress database error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 3 for query SELECT quiz_id, question_id, answer_array, question_answer_info, question_type_new, question_settings
FROM wp_mlw_questions
WHERE question_id IN () made by require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/twentytwelve/page.php'), get_template_part, locate_template, load_template, require('/themes/twentytwelve/content-page.php'), the_content, apply_filters('the_content'), WP_Hook->apply_filters, do_shortcode, preg_replace_callback, do_shortcode_tag, QMNQuizManager->display_shortcode