Just got this after running drush on the latest stable release:

Cannot redeclare class EntityReference_BehaviorHandler_Broken in entityreference/plugins/behavior/abstract.inc on line 214

That's right after:
PHP 21. ctools_plugin_load_includes() /DRUPAL7/sites/all/modules/contrib/ctools/includes/plugins.inc:271

Comments

Argus’s picture

I'm getting a similar error after installing enabling the module with drush:

Error: Call to undefined function entityreference_get_behavior_handlers() in
../modules/entityreference/entityreference.install, line 44
ShaneOnABike’s picture

I can reproduce this consistently if you first place the module in all/modules/contrib folder, enable it, and then move it to a specific sites folder, and clear cache. It's almost like the cache for the module doesn't get reset?

marblegravy’s picture

Version: 7.x-1.0 » 7.x-1.x-dev

I got this error after installing the dev version (downloaded today) and applying it over the top of the current recommended release. (I was trying to fix #1852112: Invalid field value with devel_generate) and then enabling a simple custom module that uses EntityFieldQuery().

I don't exactly know what changed, but I tried re-applying my custom module a few times and it kicked in - no sign of the Cannot redeclare class EntityReference_BehaviorHandler_Broken error.

koppie’s picture

I recommend https://drupal.org/project/registry_rebuild. I was dealing with a product that had the module installed twice in two separate directories. Drupal relied on the module from one directory but the plugins from the other directory. It was a real mess and I was getting this error constantly. (What's funny is my coworkers used a Windows dev environment and never saw the error.) It got so bad that no page would load, and even Drush wouldn't work. I ran the registry_rebuild php script and voila, the error is gone.

marblegravy’s picture

@koppie is on to something here. I just found the error again this morning after flushing all caches on the site that I'm having this problem with, but like last time, simply reloading the page seemed to clear up the issue (albiet temporarily).

Turns out I did have two versions of entity reference installed. one in sites/all/modules (installed via drush dl), and another in my site profile (/profiles/mysite/modules). The process for fixing this appears to be really tricky though because the module in error is entityreference, and my content is already using entityreference fields so Drupal wouldn't let me disable it (Required by: Drupal (Field type(s) in use - see Field list)).

In the end, I reverted to a good backup of my db and it all started working again. Not sure how you would recover from this if you didn't have a backup. @koppie's suggestion of running drush rrdidn't fix it for me.

omega8cc’s picture

There are numerous improvements committed in the Registry Rebuild head. You may want to use aggressive mode with drush rr --fire-bazooka option, if standard drush rr can't fix the problem.

dafeder’s picture

Same problem, drush rr fixed it.

mikhailkrainiuk’s picture

Issue summary: View changes

I had some problem on Mac. But I've fixed it by https://www.drupal.org/node/1305254#comment-8489393
I've made capital letters of directories to small letter and problem was fixed.

Devin Carlson’s picture

Category: Bug report » Support request
Status: Active » Fixed

This is fixed per #7 and #8.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

jacestk’s picture

Hi all,
got the same error here. I have tried all sort of things, drush cc all, drush rr...
still get this error.
I get it just after updgrading from 7.28 to 7.64 with drush (this was an internal server, not connected to web).

And this point, I can neither activate or desactivate modules.

PHP 5.4, mysql 5.5, apache 2.4