php8

php8

дэргэд Colin G -
Хариу нийтлэлийн тоо: 16

php 7x is now EOL but this plugin does not work in php8 - response reports throw errors.

Has anyone got a fix/patch to get this working in php8

Үнэлгээний дундаж: -
Colin G-н хариуд

Re: php8

дэргэд Joseph Rézeau -
Core developers зураг Particularly helpful Moodlers зураг Plugin developers зураг Testers зураг Translators зураг

We need more details!

On my localhost running PHP Version 8.1.13, Moodle 4.1, Questionnaire 3.11.1 (Build - 2022062300) I see no problem at all.

Please specify your Moodle version, Questionnaire version, PHP 8 exact version. Add screenshots, etc.


Joseph Rézeau-н хариуд

Re: php8

дэргэд Colin G -

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()


Colin G-н хариуд

Re: php8

дэргэд Joseph Rézeau -
Core developers зураг Particularly helpful Moodlers зураг Plugin developers зураг Testers зураг Translators зураг

Hi!

You write "mod_questionnaire 4.0.0 (Build - 2022030300)"

How is that possible? Latest Questionnaire available version from the Moodle plugins directoryis 3.11.1 (Build - 2022062300) (2021062301)?



Joseph Rézeau-н хариуд

Re: php8

дэргэд Colin G -
Its the version from github however the version on the Moodle plugins site has the same problem. See here:

https://github.com/PoetOS/moodle-mod_questionnaire/blob/MOODLE_400_STABLE/version.php
Colin G-н хариуд

Re: php8

дэргэд Marcus Green -
Core developers зураг Particularly helpful Moodlers зураг Plugin developers зураг Testers зураг
Can you go to admin development and set debug to developer and recreate the error?
(That is not typical of a PHP7 to 8 error message)
Marcus Green-н хариуд

Re: php8

дэргэд Colin G -
I already had developer debugging turned on. Thats all I get.

Happens in all questionnaire in all courses with or without responses when I click the "view all responses" button.
Colin G-н хариуд

Re: php8

дэргэд Colin G -
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);
Colin G-н хариуд

Re: php8

дэргэд Marcus Green -
Core developers зураг Particularly helpful Moodlers зураг Plugin developers зураг Testers зураг
Ahh, yes I can see you had set debug to developer now. So on the github version the line referred to is here

https://github.com/PoetOS/moodle-mod_questionnaire/blob/541732451a25f102fe51b8bb08e21767b5fdd974/report.php#L614
$feedbackmessages = $questionnaire->response_analysis(0, $resps, false, false, true, $currentgroupid);
The actual error occurs here
https://github.com/PoetOS/moodle-mod_questionnaire/blob/541732451a25f102fe51b8bb08e21767b5fdd974/questionnaire.class.php#L3994

$table->data[] = array($sectionlabel, $allscorepercent[$key] . '%' . $oppositeallscore);

Because $table is null

Table is supposed to be created on this line

https://github.com/PoetOS/moodle-mod_questionnaire/blob/541732451a25f102fe51b8bb08e21767b5fdd974/questionnaire.class.php#L3710

if ($this->survey->feedbackscores) {
$table = new html_table();
And for some reason it is not.

However that is all a bit guessworky on my part. I suspect there is a setting or some data that was not anticipated and your best bet is to report an issue on the github tracker and see what happens.
Marcus Green-н хариуд

Re: php8

дэргэд Colin G -

I have posted this bug on the github page so lets hope it gets fixed next release.

Colin G-н хариуд

Re: php8

дэргэд Joseph Rézeau -
Core developers зураг Particularly helpful Moodlers зураг Plugin developers зураг Testers зураг Translators зураг
I have set up a questionnaire with Feedback sections enabled and do not get any error at all.
It would really help understand your problem if you posted your questionnaire here.
Joseph Rézeau-н хариуд

Re: php8

дэргэд Colin G -

Are you using php8? 

Colin G-н хариуд

Re: php8

дэргэд Joseph Rézeau -
Core developers зураг Particularly helpful Moodlers зураг Plugin developers зураг Testers зураг Translators зураг
Joseph Rézeau-н хариуд

Re: php8

дэргэд Colin G -

php 8.0.27

try with feedback sections enabled but with no feedback sections. Then click view all responses.


Colin G-н хариуд

Re: php8

дэргэд Joseph Rézeau -
Core developers зураг Particularly helpful Moodlers зураг Plugin developers зураг Testers зураг Translators зураг

@Colin,

1.- People trying to help you here have lost a lot of time because you failed to give all the necessary information straight away, but only piece after piece.

2.- It would really have helped us help you if - as requested - you had posted your questionnaire instance on this forum.

3.- Finally you write "...try with feedback sections enabled but with no feedback sections. Then click view all responses." Why would you do that? You can't blame a piece of software for not anticipating your careless use of it.🙃 This is tantamount to blaming your car makers if you inadvertently pressed the accelerator pedal instead of the brake pedal and had an accident.

I have tried what you suggested, i.e. the weird idea of "enabling feedback sections with empty feedback sections" and I confirm that PHP 8 does throw out warnings (not errors). The reason being that PHP 8 is less tolerant than PHP 7 of approximate syntax. These are minor annoyances but do not prevent the program from working. I expect the current Questionnaire maintainer, Mike, will take some time to check Questinnaire against PHP 8 in due course.

Joseph Rézeau-н хариуд

Re: php8

дэргэд Vincent Basile -
Hi Colin,

I'm also experiencing the same error on Moodle 3.11.12 using PHP 8.0.27. Have you found a fix for this?

Thanks,

Vinny