Item Analysis error

Item Analysis error

by Adam Johnston -
Number of replies: 4
I have been trying to use item analysis to see which problems to go over from each quiz.  Plroblem is I get about 200 error lines at the top so its a pain.  The errors are all like the following (some are just citing slightly different lines int he same file):

Warning: Cannot use a scalar value as an array in /mounted-storage/home5/sub004/sc12767-ZXZI/www/cahs/moodle/mod/quiz/report/analysis/report.php on line 657

Warning: Cannot use a scalar value as an array in /mounted-storage/home5/sub004/sc12767-ZXZI/www/cahs/moodle/mod/quiz/report/analysis/report.php on line 658

It does this multiple times for each line and does it for lines 657-670.  I am assuming this is a local problem, but all the other report options work fine.  Anyone have an idea why its giving me all these errors?  They make it hard to read and print how the kids did.

Thanks
Average of ratings: -
In reply to Adam Johnston

Re: Item Analysis error

by Javier Brizuela -

I am getting the same error 1259 times, any luck?

[08-Nov-2007 16:46:26] PHP Warning:  Cannot use a scalar value as an array in C:\moodle\mod\quiz\report\analysis\report.php on line 657

I look at the code and this functions seem to be the problem:

function stats_sumx($sum, $data){
 line 657 -->  $sum[0] += $data[0];
line 658 -->   $sum[1] += $data[1];
    return $sum;
}      

function stats_sumx2($sum, $data){
line 663-->    $sum[0] += $data[0]*$data[0];
line 664-->    $sum[1] += $data[1]*$data[1];
    return $sum;
}   

function stats_sumxy($sum, $data){
line 669-->    $sum[0] += $data[0]*$data[1];
line 670-->    $sum[1] += $data[1]*$data[0];
    return $sum;
}

By the way i just upgraded to PHP 5, i really don't know if that would cause this error.

In reply to Javier Brizuela

Re: Item Analysis error

by Jean-Michel Védrine -
This error has been fixed more than 2 years and 3 months ago on all Moodle branches that I know (that is all branches after Gustav Deluis team has rewritten the quiz mod) !
Whatever Moodle branch (1.5, 1.6 or 1.7) you are using your version is very outdated !!!
Even for Moodle users still at 1.6x or 1.7x versions you should update from time to time to the latest stable version of your branch or you can't complain that bugs aren't fixed sourire
In reply to Adam Johnston

Re: Item Analysis error

by Pierre Pichet -
Which version of Moodle are you using ?
From the line numbers it seems to be moodle 1.6.
How have you set the debug level ?

Pierre

P.S. If an old version there could be a PHP 5 effect of parameter reference when calling a function. PHP4 is not working as PHP5 when transferring parameters to or from a function.