Fatal error: Class 'SelectQueryExtender' not found

Submitted by John on Wed, 12/12/2018 - 10:16

I just had to make a post about this strange issue. A client sent me a database for a Drupal 7 site so I could resolve an issue for them. I clone the site, set up a virtual machine, import the DB. But trying to interact with the site resolved in some unusual errors:

After attempting any drush command:

Drush command terminated abnormally due to an unrecoverable error. [error] Error: Call to undefined function Drush\User\user_load() in /opt/drush/lib/Drush/User/UserVersion.php, line 24 Drush was not able to start (bootstrap) Drupal. [error] Hint: This error can only occur once the database connection has already been successfully initiated, therefore this error generally points to a site configuration issue, and not a problem connecting to the database.


When hitting the front page:

>Fatal error: Class 'SelectQueryExtender' not found in /vagrant/public/includes/pager.inc on line 15

Also when trying to hit update.php:

DatabaseSchemaObjectExistsException: Cannot add index system_list to table system: index already exists. in DatabaseSchema_mysql->addIndex() (line 445 of /vagrant/public/includes/database/mysql/schema.inc).


These are basic core functions, how can they be missing!!! Not even rebuilding the registry resolved these. It took a bit of debugging to figure out, which is why using something like XDebug is crucial, but I discovered by stepping through the Drupal bootstrap process that these errors are being caused by the fact that the status for every single module, including the necessary core ones, is set to 0 in the system table. I have no idea how this can happen on a site, I'll update here as I learn more about this issue. 

Update: Nothing else to update really. I ended getting a newer database. The one I was using must have been corrupted somehow.