SOLUTION: Rebuilding the registry using solved the problem.

I manage one site in a multi-site Drupal 7.21 installation. The multisite has Chaos Tools 1.3 and Commerce 1.3 installed. The basic Drupal, Chaos Tools, and Commerce installation are not under my control, but I have the ability to add modules for my own site. For my own site, I have added Commerce Coupon 1.0-beta6 and Entity Reference 1.0-RC5. Commerce Coupon and Entity Reference were already installed when the multisite was recently upgraded from Drupal 7.13 to 7.21. It appears that when Chaos Tools was last updated, update.php was not run (or at least not successfully run) on my individual site. The Status Report says to run it immediately. The update it wants to make to the database is:

6008 - ctools_object_cache needs to be defined as a blob.

When I try to run update.php, a table in ctools_object_cache does indeed get changed from longtext to longblob, but on the screen and in logs I get the error:

PHP Fatal error: Cannot redeclare class EntityReference_SelectionHandler in /path_to_my_local_modules/modules/entityreference/plugins/selection/ on line 10

EntityReference_SelectionHandler is an interface. Grepping in the code, I can't find any place where it is being redeclared or the file re-included, but I could be missing something.

After running update.php and getting this error the first time, I started getting 500 errors when I tried to enable other modules or clear the cache, though they would go away when I refreshed. The logs, however, would show the Fatal Error again. I have restored the database to before I ran update.php, but i need to solve this problem in order to make any further updates to my site. I can't easily disable Entity Reference, because there are fields in Commerce Coupon that make use of it, and I don't want to just delete those fields in case I lose data. This is a dev mirror of the productions site, though, so I could play around with it.

Any help would be greatly appreciated.


John_B’s picture

There is an open issue for this Maybe the dev version is better. In that issue it is suggested than earlier release of Entity Reference may avoid the problem.

ericaack’s picture

Yeah, I got excited when I saw that issue, but it is actually somewhat different from my problem. That issue is for EntityReference_SelectionHandler_Broken, and the problem was the class wasn't being found, rather than the class being redeclared. I'm fortunate that a registry rebuild solved my issue. Thanks, though.