Installation help

 
 
Picture of Pascal Zajac
Error upgrading to 2.4
 

Was running Moodle 2.3.2 and went to upgrade to 2.4.1 today. I shifted the entire moodle installation directory aside and unzipped the 2.4.1 tarball in place. I copied across my old config file and themes/plugins from the old version.

Whenever I try to access any URL in the site, I receive:

Coding error detected, it must be fixed by a programmer: moodle_database::update_record_raw() id field must be specified.

There is no more useful output than this. The Apache error log simply says "Can not time out database session".

I tried using the Command Line upgrade tool instead, and receive two slightly different errors:

Default exception handler: Coding error detected, it must be fixed by a programmer: moodle_database::insert_record_raw() no fields found. Debug: 
Error code: codingerror
* line 1092 of /lib/dml/mysqli_native_moodle_database.php: coding_exception thrown
* line 1149 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->insert_record_raw()
* line 1306 of /lib/moodlelib.php: call to mysqli_native_moodle_database->insert_record()
* line 7025 of /lib/moodlelib.php: call to set_config()
* line 1502 of /lib/moodlelib.php: call to core_string_manager->reset_caches()
* line 1472 of /lib/upgradelib.php: call to purge_all_caches()
* line 153 of /admin/cli/upgrade.php: call to upgrade_core()
!!! Coding error detected, it must be fixed by a programmer: moodle_database::insert_record_raw() no fields found. !!!
!!
Error code: codingerror !!
!! Stack trace: * line 1092 of /lib/dml/mysqli_native_moodle_database.php: coding_exception thrown
* line 1149 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->insert_record_raw()
* line 1306 of /lib/moodlelib.php: call to mysqli_native_moodle_database->insert_record()
* line 7025 of /lib/moodlelib.php: call to set_config()
* line 1502 of /lib/moodlelib.php: call to core_string_manager->reset_caches()
* line 1472 of /lib/upgradelib.php: call to purge_all_caches()
* line 153 of /admin/cli/upgrade.php: call to upgrade_core()
!!

So I cannot complete the upgrade by either means. I tried swapping back to the 2.3 codebase, but I receive the same error message when attempting to access the site via a browser. This concerns me more because it implies some changes have taken place to the database, but obviously not enough to complete the upgrade process.

On top of this I've discovered I don't actually have a backup of the MySQL database, so I'm now truly freaked out at the notion of losing my Moodle installation altogether. Any help/advice would be very welcome. If there's any more information I can provide to help narrow down the cause, please let me know.

 
Average of ratings: -
Picture of Pascal Zajac
Re: Error upgrading to 2.4
 

Further investigation has shown that the problem lies with array casting in the MySQL implementation. For reference, I'm running Ubuntu 12.04 with PHP 5.3.21. The following line seems to fail in the insert_record method:

$dataobject = (array)$dataobject;

Logging out what's going on around this line reveals:

Before casting:
stdClass Object
(
    [name] => langrev
    [value] => 1359873412
)
After casting
Array
(
)

I get this same behaviour if I use the get_object_vars method instead of casting directly. Thoroughly confused.

 
Average of ratings:Useful (1)
Picture of Pascal Zajac
Re: Error upgrading to 2.4
 

Consider this withdrawn, the problem wound up lying with my MySQL server which was unable to write to the /tmp folder on my server. Once I rectified this, the upgrade proceeded without issue.

Incidentally, the above post proved to be a red herring - the problem was actually that the get_columns call was returning an empty array (if the MySQL query to obtain table information fails, an empty array is returned, which can be quite confusing when success was expected). This masked the true failings of my MySQL server.

Everything is back up and running.

 
Average of ratings: -
Picture of James Smith
Re: Error upgrading to 2.4
 

Hey Pascal,

 

I just came across this post. I am running Moodle 2.4.1 and I installed the note yet official authorize.net module (I don't know if that is the issue). To test, I enter in my credit card info and click enrol. The transaction goes through (because I receive an email from Authorize telling me) but it throws the same error as you received. 

I am not as familiar on the Mysql side, but you said your issue was a writing error. I want to test that theory for my issue. How specifically did you solve this on the server side?

 
Average of ratings: -
Starduster
Re: Error upgrading to 2.4
 

I have the exact same problem... transaction goes through but user gets the nasty error message.  Did you get it resolved?

 
Average of ratings: -