PHP Warning: in_array(): Wrong datatype for second arguement in moodle/mod/quiz/questiontypes/multichoice/questiontype.php on line 298

PHP Warning: in_array(): Wrong datatype for second arguement in moodle/mod/quiz/questiontypes/multichoice/questiontype.php on line 298

autor Barron Koralesky -
Počet odpovědí: 8

I see the following error repeated many times in my apache error log:
PHP Warning:  in_array(): Wrong datatype for second argument in /Library/WebServer/Documents/moodle/mod/quiz/questiontypes/multichoice/questiontype.php on line 298
Does this ring any bells for anyone?
Průměr hodnocení: -
V odpovědi na Barron Koralesky

Re: PHP Warning: in_array(): Wrong datatype for second arguement in moodle/mod/quiz/questiontypes/multichoice/questiontype.php on line 298

autor Paul Guimera -
I have the same problem everytime I check a result in a quiz with multichoice answers, did you manage to know how to fix it?
V odpovědi na Paul Guimera

Re: PHP Warning: in_array(): Wrong datatype for second arguement in moodle/mod/quiz/questiontypes/multichoice/questiontype.php on line 298

autor Nick Stephenson -
I had the same problem - this error seems to occur when all the grades within a multiple choice question have a zero (None) grade value.

V odpovědi na Nick Stephenson

Re: PHP Warning: in_array(): Wrong datatype for second arguement in moodle/mod/quiz/questiontypes/multichoice/questiontype.php on line 298

autor Shawn Lock -

Has there been any resolution to this? I just created my first quiz and had this problem. Thanks, Shawn.

V odpovědi na Shawn Lock

Re: PHP Warning: in_array(): Wrong datatype for second arguement in moodle/mod/quiz/questiontypes/multichoice/questiontype.php on line 298

autor Peter Bulmer -
Hi Shawn,
Sorry to hear your first experience with moodle was somewhat tainted by this problem.

Did you install moodle yourself recently?
What version of Moodle do you have?

V odpovědi na Peter Bulmer

Re: PHP Warning: in_array(): Wrong datatype for second arguement in moodle/mod/quiz/questiontypes/multichoice/questiontype.php on line 298

autor Shawn Lock -

Hi Peter,

Thanks for responding. I installed Moodle awhile ago (last year sometime) and just started a pilot class to test it out.

My hosting service, www.bluehost.com, offers it. So all I had to do was click an install button and it was installed like a desktop software. I did go up just now to the control panel for my site and there was a prompt to update. So right now I'm running 1.5.2 (Patched-1). However this was after I started the quiz. 5 people took the quiz and had the problem, but I had forewarned them so no complaints. The error message occurs after clicking the submit button and getting the results. The results are still visible to me, I just get all the error messages.

Thanks, Shawn

V odpovědi na Shawn Lock

Re: PHP Warning: in_array(): Wrong datatype for second arguement in moodle/mod/quiz/questiontypes/multichoice/questiontype.php on line 298

autor Peter Bulmer -
I haven't been around anywhere near long enough to know if your problem was fixed after 1.5.2, but I've had a quick look at the 1.6 beta code, and where you're describing, I found a line like:

if( isArray(xyz) && if inArray(abc xyz)) { blah;}

Meaning if the first part was missing in prior versions, and xyz wasn't an array, trying to see if abc was in array xyz would certainly cause it to get upset, and probabally give the exact error message you saw.

I'm prepared to give you a tentative 'yes' - the problem you're seeing has very likely been fixed in future versions.
Upgrade if you can. The current stable version is 1.5.3+

V odpovědi na Peter Bulmer

Re: PHP Warning: in_array(): Wrong datatype for second arguement in moodle/mod/quiz/questiontypes/multichoice/questiontype.php on line 298

autor Shawn Lock -

Alright. Thanks Peter. I'll see if I can get them to do the update. Thanks for your help.

All the best, Shawn

V odpovědi na Shawn Lock

Re: PHP Warning: in_array(): Wrong datatype for second arguement in moodle/mod/quiz/questiontypes/multichoice/questiontype.php on line 298

autor Wen Hao Chuang -
Shawn, when you have a chance, could you please report back to this thread whether upgrading solved your problem? We seem to have the same issue too (we are running a customized version of 1.5.2). Thanks!