generalexceptionmessage all of a sudden.

generalexceptionmessage all of a sudden.

by Brian Y -
Number of replies: 2

Has anyone seen this error before? All of a sudden started happening. Same response even if the DB credentials are invalid. latest version of 3.10.3+ on Linux/apache2/php 7.4.

Exception - Return value of moodle_database::get_columns() must be of the type array, string returned

Debug info: 
Error code: generalexceptionmessage

Stack trace: 

  • line 1161 of /lib/dml/moodle_database.php: TypeError thrown\
  • line 662 of /lib/dml/moodle_database.php: call to moodle_database->get_columns()
  • line 1703 of /lib/dml/moodle_database.php: call to moodle_database->where_clause()
  • line 1490 of /lib/moodlelib.php: call to moodle_database->get_field()
  • line 798 of /lib/setuplib.php: call to get_config()
  • line 658 of /lib/setup.php: call to initialise_cfg()
  • line 66 of /config.php: call to require_once()
  • line 30 of /index.php: call to require_once()
Anyone have any ideas?


Average of ratings: -
In reply to Brian Y

Re: generalexceptionmessage all of a sudden.

by Brian Y -
With additinal research it turns out I was wrong and when the database credentials are incorrect, it shows a message stating it can't connect to the database.

If the database is empty (new) it redirects to the install screen as expected.

If the database is full (with a working copy from a backup) it shows the above message.

I am connecting to a postgresql database.
In reply to Brian Y

Re: generalexceptionmessage all of a sudden.

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

Try purging caches. Use the command line if you can't use the site.

Line 1161 of /lib/dml/moodle_database.php is trying to retrieve some cached information:

1160                 if ($data = $this->get_metacache()->get($table)) {
1161                     return $data;
1162                 }

$data should be an array but for some reason in this case it's a string which shouldn't happen! If clearing caches fixes it then great, but if it happens again then maybe there's a Moodle bug that needs fixing.