I have migrated my moodle from one server to another, and I am getting an odd error, shown below. I am reporting this as a bug, but I plan to explore more on my own and update this tracker item.
Here is what I have that produces the error:
Production Moodle: Moodle 3.3.3+ (Build: 20171214), php 5.6.30, mysql 5.6.38.
New Experimental Moodle: Moodle 3.3.3+ (Build: 20171214), php 7.1.12, mariadb 10.1.29.
You will notice that in my new experimental moodle I have upgraded both php and the database.
In all of my courses, I have an Assignment to "Upload a photo." This assignment is identical in all of my courses. In my new experimental moodle, in some courses, this assignment works fine, but is a few courses, I get the error message shown below. Upon exploring, in the courses where this "Upload your photo" produces the error, ALL assignments produce this error. The debugging code shows, and the Boost theme characteristics (CSS) are also gone. So I wonder what is it in some courses that produces this error, and why do other courses not produce the error. It seems to have something to do with specific courses.
Also, if I create a brand new assignment in a course with an error, the error will be produced for this new assignment. If I create a new course, add an assignment, the error does not occur. If I backup a course on my production moodle, then restore it into my experimental moodle, the error shows.
I am not a programmer, but I did look at what was around lines 3665 in access lib.php, and I do see that a sql select is being performed. So it appears to me to actually be a bug that occurs when something is missing from either a role or a user.
As far as I can tell, this problem is only produced for Assignments. Quizes, Forums, etc., do not ever show this.
Please let me know what you would like me to try. I could downgrade my php version, or I could go back to MySQL instead of Mariadb. I am willing to help in any way that I can.
Here is the error message:
Notice: Undefined offset: 0 in /home/rjmoodleus/public_html/moodle/lib/accesslib.php on line 3665
Warning: array_keys() expects parameter 1 to be array, null given in /home/rjmoodleus/public_html/moodle/lib/accesslib.php on line 3665
Warning: implode(): Invalid arguments passed in /home/rjmoodleus/public_html/moodle/lib/accesslib.php on line 3665
Notice: Undefined offset: 0 in /home/rjmoodleus/public_html/moodle/lib/accesslib.php on line 3670
Warning: array_keys() expects parameter 1 to be array, null given in /home/rjmoodleus/public_html/moodle/lib/accesslib.php on line 3670
Warning: implode(): Invalid arguments passed in /home/rjmoodleus/public_html/moodle/lib/accesslib.php on line 3670
Error reading from database