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

php8 - feedback sections not working #456

Closed
grantcolin opened this issue Jan 12, 2023 · 21 comments
Closed

php8 - feedback sections not working #456

grantcolin opened this issue Jan 12, 2023 · 21 comments

Comments

@grantcolin
Copy link

Hi.... there are multiple issues with response reports and php8.

Please support php8.

@lucaboesch
Copy link
Contributor

That is a quite unhelpful Bug report.

Please share some more details, for goodness sake…

@grantcolin
Copy link
Author

Sorry here are more details. These errors do not happen with php7.4.

PHP 8.0.27
Zend Engine v4.0.27, Copyright (c) Zend Technologies
with Zend OPcache v8.0.27, Copyright (c), by Zend Technologies

mod_questionnaire 4.0.0 (Build - 2022030300)

Moodle 4.0.1+ Build: 20220527

Error happens when viewing the report:

/mod/questionnaire/report.php?instance=5&group=0

Error message:

Exception - Attempt to modify property "data" on null

More information about this error

×Debug info:
Error code: generalexceptionmessage
×Stack trace:
line 3994 of /mod/questionnaire/questionnaire.class.php: Error thrown
line 614 of /mod/questionnaire/report.php: call to questionnaire->response_analysis()

@lucaboesch
Copy link
Contributor

And what does one do before viewing the report /mod/questionnaire/report.php?instance=5&group=0?
Are there student's attempts, are there groups?
You could also opt to upload a course backup to see developers see your setup, @grantcolin.

@grantcolin
Copy link
Author

grantcolin commented Jan 14, 2023

edit:

I did some testing and this error only happens when you enable "Feedback Sections" in the feedback tab - all of the questionnaire instances had this turned on.

If you use global feedback or no feedback it works. Also commenting out works.

$feedbackmessages = $this->response_analysis($rid, $resps, $compare, $isgroupmember, $allresponses, $currentgroupid);

@grantcolin grantcolin changed the title php8 not working php8 - feedback sections not working Jan 15, 2023
@lucaboesch
Copy link
Contributor

Are there student's attempts?

@grantcolin
Copy link
Author

grantcolin commented Jan 15, 2023

Are there student's attempts?

this happens with or without attempts if feedback sections are enabled and when using php8 only.

@lucaboesch
Copy link
Contributor

Strange.
That's what I try to do exactly in this Behat test here: https://github.com/lucaboesch/moodle-mod_questionnaire/blob/viewreport/tests/behat/view_report.feature and it doesn't break.
Soon, I'll lift my development environment to PHP 8.0 or PHP 8.1, then I'll see it maybe locally.

@grantcolin
Copy link
Author

Also feedback sections enabled but none added. This error only happens with php 8 not in 7.4

@basilevm
Copy link

Hi,

I'm also experiencing the same error. I'm running Moodle 3.11.12 and PHP 8.0.27. Error goes away when I revert back to PHP 7.

@mchurchward
Copy link
Contributor

mchurchward commented Jan 31, 2023

Ah. Looks like the "data" property of the $table object is created by using it. Perhaps this doesn't work with PHP8?
But I can't recreate this. I'll make sure that the property is created and maybe it will fix it?
Ah, no. The class it uses does define this.
Can you list out very specific steps to reproduce this please?

@basilevm
Copy link

Hi Mike,

I get the error when I click on View All Responses I'm receiving the same error that Colin is. Please let me know if you need any additional info.

Debug info:
Error code: generalexceptionmessage

Stack trace:
line 3968 of \mod\questionnaire\questionnaire.class.php: Error thrown
line 614 of \mod\questionnaire\report.php: call to questionnaire->response_analysis()

@mchurchward
Copy link
Contributor

But I need steps...

  1. What questions have you added?
  2. What settings are you using?
  3. What version of questionnaire and Moodle are you using?
  4. Are they any responses?
  5. It was mentioned that you had set the Feedback options to Feedback sections. What is the display scores setting? What charts are selected?
  6. Have you added any feedback sections? What are there settings?

@basilevm
Copy link

basilevm commented Feb 1, 2023

1.What questions have you added?

Essay Box
Date
Yes/No

2.What settings are you using?

Type: Respond many
Respondent Type: Fullname
Students can view ALL responses: After answering the questionnaire
Send submission notifications: No
Save/Resume answers: No
Allow branching questions: No
Auto numbering: Auto number pages and questions
Show progress bar: No
Submission grade: No grade

3.What version of questionnaire and Moodle are you using?

Moodle: 3.11.12
PHP: 8.0.27
Plugin: 3.11.1 (Build - 2022062300)

4.Are they any responses?

Yes, there are responses. If I revert back to PHP 7.4.33 I can see them.

5.It was mentioned that you had set the Feedback options to Feedback sections. What is the display scores setting? What charts are selected?

Feedback options: Feedback sections
Display Scores: No

6.Have you added any feedback sections? What are there settings?

No Feedback sections have been added.

Please let me know if you need anything else and thank you for looking into this.

@mchurchward
Copy link
Contributor

Last question... Did you change it to have Feedback options after there were responses? Or was it all initially set up and then the responses were added?

@basilevm
Copy link

basilevm commented Feb 1, 2023

It was initially setup that way.

@mchurchward
Copy link
Contributor

I cannot replicate the problem even following your steps.
Walking through the code, the line number you quote above (3968) cannot be reached if the number of feedback sections is zero. Somehow, this questionnaire has feedback sections.
Was this copied from another survey? Is it a "public" instance?

Okay... That's it. There is one important step missing. You must have clicked the "Save settings and Edit Feedback Sections", and then never saved any sections. When I do that, I can replicate this bug.

@mchurchward
Copy link
Contributor

For reference, this error will occur if feedback was set, a feedback section was begun to be added, but then a section was never saved.

It also doesn't seem to allow the questionnaire to be changed back to "No feedback messages".

@mchurchward
Copy link
Contributor

Try the code in #464. This checks to see if feedback sections are actually being used before trying to display them.

@basilevm
Copy link

basilevm commented Feb 2, 2023

I modified the code as listed in 464. The same error shows and I don't see anything about feedback sections and if I click feedback sections I don't see anything except for adding a new one. Also if I change to global feedback the error goes away. The Yes/No question in the questionnaire that I'm experimenting with seems to be the issue if it is required. If I change it to not required the error goes away. As you stated I'm not able to revert back to "No Feedback messages". Thanks for working on this

@mchurchward
Copy link
Contributor

Please try the code in #464 again. I have added code to ensure that $table is always set.
This should not be the final solution, but a "patch" for now. The whole feedback feature needs to be rewritten properly.

@basilevm
Copy link

Updated code worked. Thank you for providing a patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants