PHP warning in calendar lib.php on line 123

PHP warning in calendar lib.php on line 123

by David Mudrák -
Number of replies: 8
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators
After 1.2.1 -> 1.3 upgrade I've input new calendar block . I've got following warning

Warning: array_diff(): Argument #1 is not an array in XXXXXXXXXX/calendar/lib.php on line 123

It seems to appear in cases when both Global events and Course events are hidden.
Is this a known bug or shall I put my focus on the code and search for my fault?

Thanx a lot...
Average of ratings: -
In reply to David Mudrák

Re: PHP warning in calendar lib.php on line 123

by Genner Cerna -

After installing in a new release of moodle 1.3, I got the same error appear after hidding  the Global Event and Course Event and this errors appeared...

Warning: Argument #1 to array_diff() is not an array in ../moodle/calendar/lib.php on line 123

Warning: Argument #1 to array_diff() is not an array in ../moodle/calendar/lib.php on line 308

By enabling Global Event and Course Event the said error will disappear, try hidding it again the error will appear..

In reply to David Mudrák

Re: PHP warning in calendar lib.php on line 123

by John Papaioannou -
I have confirmed this warning, and it is a "bug" in the distrubution, it's not on your part. The bug is fixed in CVS, but if you want to make the necessary changes yourself (very easy) do the following:

calendar/lib.php, line 123, find:

change to:


And then repeat the exact same procedure in line 308, that is:
calendar/lib.php, line 308, find:



change to:



This does not affect the operation of the calendar at all, it is just an ugly warning message. Sorry for any invonvenience! blush

Jon

In reply to John Papaioannou

Re: PHP warning in calendar lib.php on line 123

by Genner Cerna -

Thanks for the reply... Hope this will be included in moodle 1.3 release

In reply to David Mudrák

Re: PHP warning in calendar lib.php on line 123

by John Papaioannou -
Correction: the above code does not completely solve the problem after all.
The correct code you should replace the red lines with is:



Again, sorry for the mixup. I don't know right now if and how and when this is going to get into the 1.3 release archive, but I believe it will.

Jon

In reply to John Papaioannou

Re: PHP warning in calendar lib.php on line 123

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Well, 1.3 is released already ... none of the testers alerted anyone to this before.

There may be a 1.3.1 later on, or maybe someone wants to create a list of patches.
In reply to Martin Dougiamas

Re: PHP warning in calendar lib.php on line 123

by Timothy Takemoto -
I have added a calendar event to my 1.3 beta but it was not until I installed the 1.3 that the problem arose...
Tim
In reply to Timothy Takemoto

Re: PHP warning in calendar lib.php on line 123

by John Papaioannou -
Yes, I remember changing this code to accomplish something else (which introduced the bug) in the very last stages of the beta. That's why you only encountered it when 1.3 was released.
In reply to John Papaioannou

Re: PHP warning in calendar lib.php on line 123 - thanx for solution

by David Mudrák -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators
Hi, thanx a lot for your quick reply. Just yestedray I did similar (but probably not so good ...) fix for me: something using $courses = array($courses) in cases when $courses is not an array.
But I will patch my site with your code.

Have a nice time and thanx a lot for this great module.

David