4

I cloned a repo of a site to my local computer, imported the database and ran "Composer install --with-dependencies" after the installation had been done I entered the local site and it worked, then I ran "drush updb -y" and it showed a couple of errors and warnings:

    The following module is missing from the file system: aspambot       [warning]
bootstrap.inc:268
The following module is missing from the file system: phpmailer      [warning]
bootstrap.inc:268

...

PHP  27. include() /home/www/sites/zb/web/vendor/composer/ClassLoader.php:444
Drush command terminated abnormally due to an unrecoverable error.   [error]
Error: Interface 'Doctrine\Common\Reflection\ClassFinderInterface'
not found in
/home/www/sites/zb/web/core/lib/Drupal/Component/Annotation/Reflection/MockFileFinder.php,
line 14
The external command could not be executed due to an application     [error]
error.
PHP Fatal error:  Interface 'Doctrine\Common\Reflection\ClassFinderInterface' not found in /home/www/sites/zb/web/core/lib/Drupal/Component/Annotation/Reflection/MockFileFinder.php on line 14

I'm new to Drupal, so please help me get over these errors, I understand that the solution may seem straightforward to some, but I don't know what to do. Thank you!

9
  • 2
    The first error is due to the modules listed having been installed at some point so they are recorded in the database but not present in the installed source code. The second is because you are running the wrong version of Drush for your site. Is the site working or not? From these messages I would guess no DB update has occurred. Jul 23, 2018 at 13:18
  • The second appeared after I ran "Drush updb -y". I'm using Drush 8. Last update went smoothly with this version of Drush.
    – Rusletov
    Jul 23, 2018 at 13:43
  • The site is showing the following error: Fatal error: Interface 'Doctrine\Common\Reflection\ClassFinderInterface' not found in /home/www/sites/zb/web/core/lib/Drupal/Component/Annotation/Reflection/MockFileFinder.php on line 14 and a call stack.
    – Rusletov
    Jul 23, 2018 at 13:49
  • My mistake, would sound like the composer install broke something in that case. That class should be found in your vendor folder, under doctrine / common / lib / Doctrine / Common / Reflection. Jul 23, 2018 at 14:09
  • 1
    @Christia – That's not some filepath, it's a class provided by some package/library/dependency managed via Composer. But true indeed, it seems to be missing. Drupal's autoloader.php doesn't find that in the /vendor folder. Or maybe that's just what you meant ^^
    – leymannx
    Jul 24, 2018 at 22:28

3 Answers 3

5

Add "doctrine/common":">2.8" under conflict in your composer file and then run composer update.

"conflict": {
    "drupal/drupal": "*",
    "doctrine/common":">2.8"
},

See issue: https://www.drupal.org/project/drupal/issues/2986725

1

Thanks for giving a link to https://www.drupal.org/project/drupal/issues/2986725, where this problem is discussed.

That issue was closed as "works as designed". If you look at the last few comments on the issue, you will see why. The problem is caused by the PHP cache. If you clear the cache (or restart PHP or reboot your computer or use PHP on a Docker container that does not have the wrong autoload data in its cache) then the problem goes away.

Clearing the cache has fewer side effects than never updating to the current version of doctrine/common.

-2

I'm struggling with the same error, and had no time to dig the entire problem about Composer. But I came up with a workaround as follows:

  1. Delete core and vendor folders from your Drupal root directory.

    $ rm -rf core vendor

  2. From a fresh downloaded drupal, copy core and vendor folders to your Drupal root directory.

    $ cp -R core vendor /path/to/drupal/root/directory/

I had the problem on two servers. On one I managed to restore from an existing backup. And on the other I managed to resolve the problem with the steps above.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.