Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin uninstall has fatal error #3988

Closed
jom opened this issue Feb 17, 2021 · 1 comment · Fixed by #4128
Closed

Plugin uninstall has fatal error #3988

jom opened this issue Feb 17, 2021 · 1 comment · Fixed by #4128
Labels
Milestone

Comments

@jom
Copy link
Member

jom commented Feb 17, 2021

It looks like this might be caused, possibly, by accessing terms through trash -> lesson order -> course structure after the taxonomy has been removed.

Steps to Reproduce

  1. Create a course with a module and lessons.
  2. Enable option to delete data on uninstall.
  3. Deactivate and uninstall the plugin.

What I Expected

The plugin to be uninstalled

What Happened Instead

Fatal error.

PHP / WordPress / Sensei LMS version

PHP 7.4 / WP 5.6 / Sensei LMS 3.8.1

Work around

Trash all courses and lessons before deleting Sensei

Example Debug Log

Notice: Trying to get property 'term_id' of non-object in /srv/htdocs/wp-content/plugins/sensei-lms/includes/class-sensei-modules.php on line 1489 
Notice: Trying to get property 'term_id' of non-object in /srv/htdocs/wp-content/plugins/sensei-lms/includes/class-sensei-modules.php on line 1489 
Notice: Undefined index: term_id in /srv/htdocs/__wp__/wp-includes/class-wp-list-util.php on line 161 
Notice: Undefined index: term_id in /srv/htdocs/__wp__/wp-includes/class-wp-list-util.php on line 161 
Notice: Trying to get property 'term_id' of non-object in /srv/htdocs/wp-content/plugins/sensei-lms/includes/class-sensei-modules.php on line 1489 
Notice: Trying to get property 'term_id' of non-object in /srv/htdocs/wp-content/plugins/sensei-lms/includes/class-sensei-modules.php on line 1489 

Fatal error: Uncaught TypeError: Argument 1 passed to Sensei_Course_Structure::prepare_module() must be an instance of WP_Term, array given, called in /srv/htdocs/wp-content/plugins/sensei-lms/includes/class-sensei-course-structure.php on line 84 and defined in /srv/htdocs/wp-content/plugins/sensei-lms/includes/class-sensei-course-structure.php:121 
Stack trace: 
#0 /srv/htdocs/wp-content/plugins/sensei-lms/includes/class-sensei-course-structure.php(84): Sensei_Course_Structure->prepare_module(Array, 'any') 
#1 /srv/htdocs/wp-content/plugins/sensei-lms/includes/class-sensei-admin.php(1581): Sensei_Course_Structure->get('edit') 
#2 /srv/htdocs/wp-content/plugins/sensei-lms/includes/class-sensei-admin.php(1536): Sensei_Admin->get_course_structure(46)
#3 /srv/htdocs/wp-content/plugins/sensei-lms/includes/class-sensei-lesson.php(462): Sensei_Admin->save_lesson_order('', 46) 
#4 /srv/htdocs/__wp__/wp-includes/class-wp-hook.php(289): Sensei_Lesson->add_lesson_to_course_order(47) 
#5 /srv/htdocs/__wp__/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters(false, Array) 
#6 /srv/htdocs/__wp__/wp-includes/plugin.php(484): WP_Hook->do_action(Array) 
#7 /srv/htdocs/__wp__/wp-includes/post.php(4309): do_action('save_post', 47, Object(WP_Post), true) 
#8 /srv/htdocs/__wp__/wp-includes/post.php(4411): wp_insert_post(Array, false, true) 
#9 /srv/htdocs/__wp__/wp-includes/post.php(3222): wp_update_post(Array) 
#10 /srv/htdocs/wp-content/plugins/sensei-lms/includes/class-sensei-data-cleaner.php(284): wp_trash_post(47) 
#11 /srv/htdocs/wp-content/plugins/sensei-lms/includes/class-sensei-data-cleaner.php(257): Sensei_Data_Cleaner::cleanup_custom_post_types() 
#12 /srv/htdocs/wp-content/plugins/sensei-lms/uninstall.php(43): Sensei_Data_Cleaner::cleanup_all() 
#13 /srv/htdocs/__wp__/wp-admin/includes/plugin.php(1261): include_once('/srv/htdocs/wp-...') 
#14 /srv/htdocs/__wp__/wp-admin/includes/plugin.php(967): uninstall_plugin('sensei-lms/sens...') 
#15 /srv/htdocs/__wp__/wp-admin/includes/ajax-actions.php(4573): delete_plugins(Array) 
#16 /srv/htdocs/__wp__/wp-includes/class-wp-hook.php(287): wp_ajax_delete_plugin('') 
#17 /srv/htdocs/__wp__/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters('', Array) 
#18 /srv/htdocs/__wp__/wp-includes/plugin.php(484): WP_Hook->do_action(Array) 
#19 /srv/htdocs/__wp__/wp-admin/admin-ajax.php(184): do_action('wp_ajax_delete-...')
#20 {main} thrown in /srv/htdocs/wp-content/plugins/sensei-lms/includes/class-sensei-course-structure.php on line 121
@donnapep
Copy link
Collaborator

donnapep commented Apr 6, 2021

Fixed by #4128.

@donnapep donnapep closed this as completed Apr 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants