(Moodle 2.0.1) Coding error detected, it must be fixed by a programmer: PHP catchable fatal error

(Moodle 2.0.1) Coding error detected, it must be fixed by a programmer: PHP catchable fatal error

by Wenceslao Fernández -
Number of replies: 10

Hi smile

I get this error when trying to see any scale, it happens in both, Site > Admin > Grades > Scales, and in all courses, Settings > Grader administratios > Scales...

Coding error detected, it must be fixed by a programmer: PHP catchable fatal error

It is a Moodle 2.0.1+ (Build 20110112) upgraded from a previous 1.9.x version. I think that it is the only problem we have, it is stable and working quite fine, but we need some personal scales.

Almost all the activities, blocks and plugins are standard, just the BBB (Moodle 2 native) and the Feedback module upgradded from the 1.9.

Any idea? Thanks in advance.

Salu2

Attachment modules.png
Average of ratings: -
In reply to Wenceslao Fernández

Re: (Moodle 2.0.1) Coding error detected, it must be fixed by a programmer: PHP catchable fatal error

by Wenceslao Fernández -

Hi smile

Some extra info from the debugger

Debug info: Argument 2 passed to moodle_database::record_exists() must be an array, string given, called in /var/www/vhosts/xxxx.xxxx.com/httpdocs/mod/bigbluebutton/lib.php on line 244 and defined
Stack trace:
  • line 351 of /lib/setuplib.php: coding_exception thrown
  • line 1520 of /lib/dml/moodle_database.php: call to default_error_handler()
  • line 244 of /mod/bigbluebutton/lib.php: call to moodle_database->record_exists()
  • line 281 of /lib/grade/grade_scale.php: call to bigbluebutton_scale_used_anywhere()
  • line 139 of /grade/edit/scale/index.php: call to grade_scale->is_used()

It seems that BBB activity is the problem...

In reply to Wenceslao Fernández

Re: (Moodle 2.0.1) Coding error detected, it must be fixed by a programmer: PHP catchable fatal error

by Erin Bard -

Hi Wenceslao,

I am having the same error and I think I can explain what it means and provide a short-term fix.

In the .../mod/bigbluebutton/lib.php file on line 244 there is a call to the database using
"$DB->record_exists('bigbluebutton', 'grade', -$scaleid)", however this seems to be a pre-2.0 function, according to this page: http://docs.moodle.org/en/Development:DML_functions_-_pre_2.0#Seeing_if_any_records_exist_match_a_given_criteria

Specifically it looks like they are attempting to query the 'bigbluebutton' table and find the field titled 'grade' where value equals the variable $scaleid.

However, in 2.0+ the database query should be formated like this:
http://docs.moodle.org/en/Development:DML_functions#Seeing_if_one_record_exists

Furthermore, on my installation of Moodle (2.0.2 Build: 20110221), the BigBlueButton (v. 2010123100) database table does not have a field titled 'grade'. So there seems to be several issues with this line of code and, frankly, I'm not entirely sure what BigBlueButton is trying to do here, so I cannot say what the proper solution should be.

Judging from the comments for that block of code:
"Checks if scale is being used by any instance of bigbluebutton. * This function was added in 1.9 * This is used to find out if scale used anywhere"
It seems that the database is queried by BigBlueButton in order to find any custom grade scales that have been applied, however since this line of code seems to be either inaccurate or out of date, it causes the error we observed.

I was able to solve the problem in the short term by commenting out that line and the lines surrounding it (an If statement) and simply have that function always return false. This quick fix solved the error you and I were getting and I have not observed any further errors or complications in either Moodle or BigBlueButton as a result of my change, though I am not doing anything related to grades in BigBlueButton so there could be problems that are not apparent from my testing.

In the long term it would probably be best to alert the maintainer of the BigBlueButton module and tell them that they have a likely bug in their code. The author of those php files is listed as Fred Dixon (ffdixon [at] blindsidenetworks [dt] org), so perhaps an email to him would be appropriate? I think that is the approach I will be taking.

I hope that helps!

Erin

My background: though this is my first time posting on the forum, I've been reading the forums for about a year and am the lead programmer for my college's moodle installation.

Average of ratings: Useful (1)
In reply to Erin Bard

Re: (Moodle 2.0.1) Coding error detected, it must be fixed by a programmer: PHP catchable fatal error

by Fred Dixon -

Thanks Erin for pointing this out.  The correct fix is to simply comment out the statement and return false.

I'll apply the fix to the Moodle module and release an update shortly.

Thanks again for spotting this.

Regards,... Fred

In reply to Fred Dixon

Re: (Moodle 2.0.1) Coding error detected, it must be fixed by a programmer: PHP catchable fatal error

by Rada kichenin -

Hi Fred,

I am also getting the same error the debug message points to bigbluebutton. Did you have the time to fix the issue and release an update?

Regards

Kichenin

In reply to Erin Bard

Re: (Moodle 2.0.1) Coding error detected, it must be fixed by a programmer: PHP catchable fatal error

by sandi weldon -

OMG What does this mean? can someone please translate this into English?  I'm getting the coding error and need to get into my students' quizzes to read their responses. I click on "Review Attempt" and just gt the coding error message over and over.  Please help!

In reply to sandi weldon

Re: (Moodle 2.0.1) Coding error detected, it must be fixed by a programmer: PHP catchable fatal error

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

You (as an end user) should never see conding_errors. They are used to report things that only happen if a developer screwed up somewhere. Of course, bugs do happen. If you set Debugging to DEVELOPER level, then there will be more useful output. That may also be incomprehensible to you, but you could copy-and-paste it here.

In reply to Tim Hunt

Re: (Moodle 2.0.1) Coding error detected, it must be fixed by a programmer: PHP catchable fatal error

by Laura Baxter -

I get the same error message when I have tried to delete a course in 2.2.  I added a course and chose the theme "grid" which it didn't like at all.  The course then stopped working and when we try to delete the course, we get the coding message.  We also got the same message when we tried to delete a course that did not restore fully. 

In reply to Tim Hunt

Re: (Moodle 2.0.1) Coding error detected, it must be fixed by a programmer: PHP catchable fatal error

by ramdhan purnama -

hello i have a problem, I tried to answer a quiz, then I want to see the results of the quiz, but appears "error reading from the database" here's an example picture:

Debug info: Unknown column 'checkbox' in 'order clause'
SELECT CONCAT(u.id, '#', COALESCE(qa.attempt, 0)) AS uniqueid, qa.uniqueid AS attemptuniqueid, qa.id AS attempt, u.id AS userid, u.idnumber, u.firstname, u.lastname, u.picture, u.imagealt, u.email, qa.sumgrades, qa.timefinish, qa.timestart, qa.timefinish - qa.timestart AS duration , COALESCE((SELECT MAX(qqr.regraded) FROM mdl_quiz_question_regrade qqr WHERE qqr.attemptid = qa.uniqueid),-1) AS regraded FROM mdl_user u LEFT JOIN mdl_quiz_attempts qa ON qa.userid = u.id AND qa.quiz = ? WHERE qa.id IS NOT NULL AND qa.preview = 0 ORDER BY checkbox ASC, uniqueid ASC LIMIT 0, 30
[array (
0 => '4',
)]
Stack trace:

    line 391 of /lib/dml/moodle_database.php: dml_read_exception thrown
    line 790 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
    line 1354 of /lib/tablelib.php: call to mysqli_native_moodle_database->get_records_sql()
    line 323 of /mod/quiz/report/overview/overview_table.php: call to table_sql->query_db()
    line 1375 of /lib/tablelib.php: call to quiz_report_overview_table->query_db()
    line 391 of /mod/quiz/report/overview/report.php: call to table_sql->out()
    line 90 of /mod/quiz/report.php: call to quiz_overview_report->display()
In reply to ramdhan purnama

Re: (Moodle 2.0.1) Coding error detected, it must be fixed by a programmer: PHP catchable fatal error

by Educational Technology Leaders LLC -

Did you find a solution for this? I am having the same issue

In reply to Educational Technology Leaders LLC

Απάντηση: Re: (Moodle 2.0.1) Coding error detected, it must be fixed by a programmer: PHP catchable fatal error

by Panagiotis Iliopoulos -

When I had this problem I logged off and then logged on back again and the problem was gone.


Try it, it worked for me.