Automattic / sensei

Sensei LMS - Online Courses, Quizzes, & Learning
https://senseilms.com
GNU General Public License v2.0
530 stars 197 forks source link

Trying to get property 'ID' of non-object #6412

Open vinvin27 opened 1 year ago

vinvin27 commented 1 year ago

Hello,

We received this email as administrator of our website. We don't know how to reproduce it...

Notice: Trying to get property 'ID' of non-object in /home/USER_WEBSITE/public_html/wp-content/plugins/sensei-lms/includes/class-sensei-messages.php on line 767

The stack

| Time | Memory | Function | Location

-- | -- | -- | -- | -- 1 | 0.0003 | 452024 | {main}( ) | .../admin.php:0 2 | 3.3708 | 196195040 | do_action( $hook_name = 'sensei-lms_page_sensei_grading' ) | .../admin.php:259 3 | 3.3708 | 196195416 | WP_Hook->do_action( $args = [0 => ''] ) | .../plugin.php:476 4 | 3.3708 | 196195416 | WP_Hook->apply_filters( $value = '', $args = [0 => ''] ) | .../class-wp-hook.php:331 5 | 3.3708 | 196196544 | Sensei_Grading->grading_page( '' ) | .../class-wp-hook.php:307 6 | 3.3708 | 196196544 | Sensei_Grading->grading_user_quiz_view( ) | .../class-sensei-grading.php:168 7 | 3.3735 | 196300896 | Sensei_Grading_User_Quiz->display( ) | .../class-sensei-grading.php:270 8 | 3.3922 | 196347376 | Sensei_Question::get_the_question_description( $question_id = 6461 ) | .../class-sensei-grading-user-quiz.php:317 9 | 3.3923 | 196347824 | apply_filters( $hook_name = 'the_content', $value = 'Merci de remettre votre travail en cliquant sur le bouton ci-bas.' ) | .../class-sensei-question.php:684 10 | 3.3923 | 196348232 | WP_Hook->apply_filters( $value = 'Merci de remettre votre travail en cliquant sur le bouton ci-bas.', $args = [0 => 'Merci de remettre votre travail en cliquant sur le bouton ci-bas.'] ) | .../plugin.php:191 11 | 3.3932 | 196354024 | Sensei_Messages->message_content( $content = '

Merci de remettre votre travail en cliquant sur le bouton ci-bas.

\n' ) | .../class-wp-hook.php:307

donnapep commented 1 year ago

Looks like this is coming from the message_content function. We should add a check that ID exists before trying to access it.