General help

 
 
Picture of Jay Huber
Course PHP Errors - Moodle 2.3.4+ (Build: 20130125)
 

Running Moodle latest weekly build.  When an instructor deletes several items from their course, occassionally, the course locks to "Coding error detected, it must be fixed by a programmer: PHP catchable fatal error."

I have debugging on for my user, and do not get any error messages.  I have found that deleting the sectioncache in the database for course in question causes it to start working again.

I am trying to narrow down the cause of this problem so I can research it on tracker.  I did a diff of the sectioncache before I blanked it out, and what was regenerated when I accessed the course.  No difference.

It's the first day of spring classes and I have had this happen 4 times today alone.

So, when the sectioncache is wiped out, and the course loads, what other checks are being performed?  Any ideals?

 

 
Average of ratings: -
Picture of Howard Miller
Re: Course PHP Errors - Moodle 2.3.4+ (Build: 20130125)
Group DevelopersGroup Documentation writersGroup Particularly helpful Moodlers

Switch on Debugging. Look in your web server error log after to problem is reported. Hopefully you will find a trace of what actually happened.

Do you have any optional plugins? These can sometimes give problems. Make sure they are the correct/most recent versions.

 
Average of ratings: -
Picture of Jay Huber
Re: Course PHP Errors - Moodle 2.3.4+ (Build: 20130125)
 

Thanks

I captured a course that this is happening too and copied my production sql to my development box and am now getting the error.

Debug info: Argument 2 passed to has_capability() must be an instance of context, boolean given, called in /Library/WebServer/Documents/moodle23x/lib/modinfolib.php on line 1097 and defined

Thanks for your help.  Need to do more research on the cause of this and search tracker.

 
Average of ratings: -
Picture of Andrew Nicols
Re: Course PHP Errors - Moodle 2.3.4+ (Build: 20130125)
Group DevelopersGroup Moodle HQGroup Particularly helpful MoodlersGroup Testers

Hi Jay,

If you stick the following in on the 1095 (just before the failing if test), then it should generate a stacktrace which will help track down the issue:

if ((!$this->visible or !$this->available) and is_bool($modcontext)) { throw new moodle_exception('generatingstacktrace'); }

Andrew

 
Average of ratings: -
Picture of Brad Meyer
Re: Course PHP Errors - Moodle 2.3.4+ (Build: 20130125)
 

I upgraded to the latest weekly (as of 1/31) and added that code in. Here's what I get:

[01-Feb-2013 17:26:46 UTC] Default exception handler: error/generatingstacktrace Debug:
Error code: generatingstacktrace
$a contents:
* line 1096 of \lib\modinfolib.php: moodle_exception thrown
* line 1072 of \lib\modinfolib.php: call to cm_info->update_user_visible()
* line 327 of \lib\modinfolib.php: call to cm_info->obtain_dynamic_data()
* line 1261 of \lib\modinfolib.php: call to course_modinfo->__construct()
* line 1928 of \lib\navigationlib.php: call to get_fast_modinfo()
* line 1989 of \lib\navigationlib.php: call to global_navigation->generate_sections_and_activities()
* line 47 of \course\format\topics\lib.php: call to global_navigation->load_generic_course_sections()
* line 1903 of \lib\navigationlib.php: call to callback_topics_load_content()
* line 1257 of \lib\navigationlib.php: call to global_navigation->load_course_sections()
* line 3043 of \lib\navigationlib.php: call to global_navigation->initialise()
* line 781 of \lib\pagelib.php: call to navbar->has_items()
* line 4 of \theme\leatherbound\layout\general.php: call to moodle_page->has_navbar()
* line 768 of \lib\outputrenderers.php: call to include()
* line 715 of \lib\outputrenderers.php: call to core_renderer->render_page_layout()
* line 232 of \course\view.php: call to core_renderer->header()

 

Also, here's what I got before I added that in:

[01-Feb-2013 17:22:47 UTC] Default exception handler: Coding error detected, it must be fixed by a programmer: PHP catchable fatal error Debug: Argument 2 passed to has_capability() must be an instance of context, boolean given, called in C:\inetpub\wwwroot\lib\modinfolib.php on line 1097 and defined
Error code: codingerror
* line 397 of \lib\setuplib.php: coding_exception thrown
* line 355 of \lib\accesslib.php: call to default_error_handler()
* line 1097 of \lib\modinfolib.php: call to has_capability()
* line 1072 of \lib\modinfolib.php: call to cm_info->update_user_visible()
* line 327 of \lib\modinfolib.php: call to cm_info->obtain_dynamic_data()
* line 1260 of \lib\modinfolib.php: call to course_modinfo->__construct()
* line 1928 of \lib\navigationlib.php: call to get_fast_modinfo()
* line 1989 of \lib\navigationlib.php: call to global_navigation->generate_sections_and_activities()
* line 47 of \course\format\topics\lib.php: call to global_navigation->load_generic_course_sections()
* line 1903 of \lib\navigationlib.php: call to callback_topics_load_content()
* line 1257 of \lib\navigationlib.php: call to global_navigation->load_course_sections()
* line 3043 of \lib\navigationlib.php: call to global_navigation->initialise()
* line 781 of \lib\pagelib.php: call to navbar->has_items()
* line 4 of \theme\leatherbound\layout\general.php: call to moodle_page->has_navbar()
* line 768 of \lib\outputrenderers.php: call to include()
* line 715 of \lib\outputrenderers.php: call to core_renderer->render_page_layout()
* line 232 of \course\view.php: call to core_renderer->header()

 

One more thing, the only other error that I can see now (at least since upgrading to the 1/31 build) is a ton of Permission Denied errors like (all referring to line 6594 in moodlelib.php:

[01-Feb-2013 17:22:47 UTC] PHP Warning:  file_put_contents(C:\moodledata/cache/lang/en/core_debug.php): failed to open stream: Permission denied in C:\inetpub\wwwroot\lib\moodlelib.php on line 6594

 
Average of ratings: -
Picture of Brad Meyer
Re: Course PHP Errors - Moodle 2.3.4+ (Build: 20130125)
 

I updated my test server to 2.4.1+ and am still getting the errors.

 
Average of ratings: -
Picture of Brad Meyer
Re: Course PHP Errors - Moodle 2.3.4+ (Build: 20130125)
 

I'm getting the above issue with the same build. Also, course restores are not working and teachers are having trouble uploading files.

 
Average of ratings: -
Picture of Brad Meyer
Re: Course PHP Errors - Moodle 2.3.4+ (Build: 20130125)
 

https://tracker.moodle.org/browse/MDL-37820

Dan said it was fixed in the 2.3.4+ weekly (20130131) as I haven't seen it again since upgrading.

 
Average of ratings: -
Picture of Brad Meyer
Re: Course PHP Errors - Moodle 2.3.4+ (Build: 20130125)
 

Also, here's the SQL Query I ran to unlock any courses (for all you SQL n00bs like me):

 update mdl_course set modinfo = '' where id = XXX;

 

Thank you Andrew for the tip!

 
Average of ratings: -
Picture of Ben Kelada
Re: Course PHP Errors - Moodle 2.3.4+ (Build: 20130125)
 

We have replicated this bug (differently than what was eventually described above)

replication case: https://tracker.moodle.org/browse/MDL-37763

cause of error: https://tracker.moodle.org/browse/MDL-37939

just writing here as this was first search result when we initially looked for this error and it lead us down the wrong path!

 
Average of ratings:Useful (1)
Picture of Luciano Silva
Re: Course PHP Errors - Moodle 2.3.4+ (Build: 20130125)
 

This is alread correted in build 20130228. But if you update, the complete solution is this:

Clear column modinfo from md_course:

update mdl_course set modinfo = "" where id = XXX;

update mdl_course set sectioncache = "" where id = XXX;

And aply the patchs.

 

 

 
Average of ratings:Useful (1)
Picture of Ludwig Röder
Re: Course PHP Errors - Moodle 2.3.4+ (Build: 20130125)
 

thanks for the solution!

my question is: how could the data become damaged? i updated my system to Moodle 2.3.4+ (Build: 20130228) two weeks ago and got the error today. Would it be clever to clear this columns for all courses? What exactly do these columns save, course-content or only modification-infos?

What kind of courses can be damaged?

 

thanks for support!

 

 
Average of ratings: -