Error: Argument 1 passed to questionnaire::build_response_from_appdata() must be an instant of stdClass, array given

Error: Argument 1 passed to questionnaire::build_response_from_appdata() must be an instant of stdClass, array given

by Visvanath Ratnaweera -
Number of replies: 9
Picture of Particularly helpful Moodlers Picture of Translators

Our students sporadically get this error sporadically:

Error: Argument 1 passed to questionnaire::build_response_from_appdata() must be an instant of stdClass, array given, called in moodle/mod/questionnaire/questionnaire.class.php on line 4010

I'm not the admin, therefore don't have full debug trace. Still wanted to ask whether this is know otherwise.

Moodle version 3.11, theme Fordson

Average of ratings: -
In reply to Visvanath Ratnaweera

Re: Error: Argument 1 passed to questionnaire::build_response_from_appdata() must be an instant of stdClass, array given

by Isabel Renedo -
Picture of Moodle HQ Picture of Particularly helpful Moodlers
Hi Visvanath,

Questionnaire is a plugin (https://moodle.org/plugins/mod_questionnaire), take into account they are not part of Moodle core and they are not maintained by Moodle HQ, please contact the authors and/or maintainers of the that plugin so they can revise the possible issue.


Best regards,

Isabel
In reply to Isabel Renedo

Re: Error: Argument 1 passed to questionnaire::build_response_from_appdata() must be an instant of stdClass, array given

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Thanks, I wasn't sure where to raise the question: Moodle mobile, or Questionnaire, or Fordson or Moodle 3.11.

@Dear Moderator, could you pl. move this discussion to the Questionnaire forum?

@all, my intensive interaction with this group of students during a two week intensive workshop is now over. So I won't follow up. I'm not the site admin anyway. So low prio. Just in case somebody else observe the same thing.
In reply to Visvanath Ratnaweera

Re: Error: Argument 1 passed to questionnaire::build_response_from_appdata() must be an instant of stdClass, array given

by Veda Beeharry -
Hi there,
We've been investigating how Questionnaire works in the OU Study app and received a very similar error message as originally reported by Visvanath Ratnaweera, and we'd be keen to understand what this means:
The error message says:

questionnaire::build_response_fromappdata(): Argument #1 ($appdata) must be of type stdClass, array given, called in/var/www/html/moodle/mod/questionnaire.class.php on line 4023

We're looking into how we can get Questionnaire to work in the app and if this is something that is a fairly easy resolve or requires a workaround or if there are plans to make this compatible in the app? Thanks.
In reply to Veda Beeharry

Re: Error: Argument 1 passed to questionnaire::build_response_from_appdata() must be an instant of stdClass, array given

by Mike Churchward -
Picture of Core developers Picture of Plugin developers Picture of Testers
Are you getting an error, or a warning? It does look like the function expects a stdClass but is being passed an array. I'll create an issue to fix that.
In reply to Visvanath Ratnaweera

Re: Error: Argument 1 passed to questionnaire::build_response_from_appdata() must be an instant of stdClass, array given

by Mike Churchward -
Picture of Core developers Picture of Plugin developers Picture of Testers
What version of questionnaire are you using? The line you quoted above does not call that function.
In reply to Mike Churchward

Re: Error: Argument 1 passed to questionnaire::build_response_from_appdata() must be an instant of stdClass, array given

by Veda Beeharry -

Sorry for the delay, Mike. Having spoken with my colleague, Chris Nelson
I can confirm we're on the latest, v3.11.1 (24 June 2022), from the plugin page: 3.11.1 (Build - 2022062300),  2021062301

I hope this info makes sense! 

In reply to Veda Beeharry

Re: Error: Argument 1 passed to questionnaire::build_response_from_appdata() must be an instant of stdClass, array given

by Mike Churchward -
Picture of Core developers Picture of Plugin developers Picture of Testers
Ah. Okay. That was fixed in the 3.11 branch in pull request 458, and is also fixed in the MOODLE_400_STABLE branch.
In reply to Mike Churchward

Re: Error: Argument 1 passed to questionnaire::build_response_from_appdata() must be an instant of stdClass, array given

by Veda Beeharry -
Just to confirm: I should no longer receive the error message if I was to attempt these in the OU Study app now? Or are the changes yet to go live? Thank you.
In reply to Veda Beeharry

Re: Error: Argument 1 passed to questionnaire::build_response_from_appdata() must be an instant of stdClass, array given

by Mike Churchward -
Picture of Core developers Picture of Plugin developers Picture of Testers
They are live in the github branch referred to above. They are not released to the Moodle Plugin Database yet.