I'm not sure what is causing this, but after updating to the latest dev an existing View of mine is dying with a fatal error. Specifically:
Fatal error: Class 'EntityReference_SelectionHandler_Broken' not found in /home/crell/public_html/webbspace7/sites/all/modules/entityreference/entityreference.module on line 159
What confuses me is that class does exist, and is in plugins/selection/abstract.inc. That file is listed in the files[] array in the info file, as it should be. I have flushed and reloaded the registry and all caches, yet that class is not showing up in the registry for some reason. In fact, the entire plugin directory is missing from the registry.
I suspect some bizarre ctools interaction, since I know it does funky things with the registry in the name of DX, but I'm not sure what or why.
| Comment | File | Size | Author |
|---|---|---|---|
| #52 | 1423778-52.patch | 1.57 KB | alex.skrypnyk |
| #51 | 1423778-51.patch | 1.56 KB | joseph.olstad |
| #42 | entityreference-1423778-brokenhandler.diff | 1.56 KB | robloach |
| #34 | entityreference-includeselectionhandlerabc-707484-34.patch | 475 bytes | plonk |
| #33 | entityreference-includebehaviorohandlerabc1-707484-29.patch | 626 bytes | plonk |
Comments
Comment #1
damien tournoud commentedThere seems to be two issues here:
- the selection handler you are using failed to load (probably because our CTools classes were not named properly)
- the broken handler also failed to load
The first issue should be fixed in the current dev version. I have no idea why you are bumping in the second. I did check and the broken handler is properly registered in the registry on my current install.
Could you check if the current 7.x-1.x branch fixes the issue(s) for you?
Comment #2
shendric commentedHello,
I'm just seconding this issue. I just tried to install the latest dev version and I got that same error when I tried to create an Entity Reference field on a content type.
Comment #3
Crell commentedI just tried again with today's dev snapshot. Same problem. Complete error message follows:
Edit: I tried this with the last stable ctools and with today's ctools dev snapshot. No change.
Comment #4
Crell commentedAnd I have no clue what I did, but I just spent the last hour stepping through the registry rebuild process in ctools in a debugger without changing anything. And now it does work. I haven't a clue how or why, since I'd cleared all my caches before multiple times.
Comment #5
amitaibu@Crell,I definitely think magic is somehow related :)
Comment #6
mrconnerton commentedI've upgraded to the latest dev and have the same error. Attempting to find the magic.
Comment #7
mrconnerton commentedI went back to 7.x-1.0-beta3 and stepped up one commit at a time. I got up to d9a914dbb8c176b04b6326260cc3565cd8c47e49 which was the last commit before stuff started to break for me.
d9460f8c0633ccbfdad8c0cf9914f7e312282ee4 is when things got hinky. Every commit after this tossed errors.
I have the latest dev of ctools and field_collection modules in addition to the working commit above of this.
Comment #8
micheas commentedThis may or may not help as a clue to what is going on, but I "fixed" this on two sites by running 'drush cache-clear'. On one site I had to clear the cache twice.
I don't understand drupal's caching well enough to know what the problem was.
Comment #9
mrfelton commentedI also get this error when trying to edit a node that has an entityreference field with no value set. entityreference-7.x-1.0-beta5 and latest ctools dev. Clearing the cache, or registry has no effect.
Comment #10
creativenode commentedI had this error and fixed it by clearing each cache separately via Drush. If I cleared all caches I got some error messages (see below) but after clearing them individually all worked fine. Subsequent clearing of all caches work without a problem.
Comment #11
DizzyC commentedHad the same issue with beta-5.
I have just updated to rc1 and the problem has gone away.
This issue might be fixed.
Can anyone confirm that the problem is gone with rc1?
Comment #12
mrfelton commentedStill get the problem with rc1.
EDIT: Actually, after flushing the caches with a call to drupal_flush_all_caches(), the problem has gone away.
Comment #13
Joel MMCC commented@mrfelton (re: #12), I, too, still have the same problem with rc1.
I’ve not yet tried clearing all caches with rc1 in place, since it was a production site and had to be back up ASAP so I restored beta3 (the last working version for us) from the drush-backups folder before finding this Issue.
But since “drush pm-update” includes “drush updatedb” which clears all caches after applying the pending database updates (if any — it still clears the caches even if there are no pending updates, and there were some in this case for other modules that got updated in the same pass), I’d’ve thought that this would’ve worked, and come to think of it, I did check the View after doing the update a couple days ago, and things were working fine.
Yet a couple days later, they’re not. So, apparently, if there is any caching going on, it breaks again, even if it was working fine before. Methinks that clearing the caches is only a temporary solution, a band-aid that needs to be applied repeatedly.
Since this completely disables sites that use certain key modules, I think that this should at least be “major,” if not “critical.”
Comment #14
damien tournoud commentedDoes anyone know how to reproduce the problem? Only a fraction of people seem to be affected by the problem. Could anyone give more details here (especially the versions of Drupal core, contributed modules and Drush affected by the problem)?
Comment #15
Joel MMCC commented@Damien (#14), I suspect now that it may be the Calendar module and its related Date module. A few releases ago, KarenS deprecated the Calendar Items Views Format, and replaced it with Calendar Entities. For awhile there, these were not working correctly (#1394108: New Calendar Entities Format not working!), but are now.
However, anyone who’d set up their Calendar using the Date Tools Wizard (highly recommended as it automates a lot of drudge work in setting up the necessary Views) until relatively recently had their Calendar set up to use the now-deprecated Calendar Items for all View Displays except Upcoming (which just uses Fields from the calendar Event node type) and RSS (which uses a special Date Feed API). The latest versions of the modules now includes an updated Date Tools with a new Wizard that builds the Calendar View Displays (Master, Day, Week, Month, Year, Block, etc.) using Calendar Entities instead of Calendar Items, and since the old Views can no longer be deleted from the Views listing, the Date Tools also provides a user interface for deleting old Wizard-built Calendar Views.
Basically, if you have Calendar, you should Export your existing Calendar View(s) (especially if you’ve customized them), then use the Date Tools to delete it/them, then the Date Tools Wizard to recreate it/them, then re-apply any customizations manually by using the Export info to remind you of them.
I suspect that having an old-format Calendar using Items instead of Entities may be interacting with Entity Reference to cause the error message. For me, it happened with the Front page that has a Block displaying the Upcoming Events (from the Upcoming Display of the old Wizard-built View, customized by me) that was set to appear only on the Front page. That was the only page that gave the error (I never tried it with an actual Calendar View Display [Day, Week, Month, or Year] page, though I suspect that it would’ve happened then as well). The Upcoming Display does not use Items nor Entities, but it would still reference the Master Display, which did use Calendar Items, and so if there was an interaction with Entity Reference involving Calendar Items, then it could conceivably still be triggered by even the Upcoming or RSS Displays.
I have since converted the View to use Entities on all Displays (except Upcoming and RSS, the latter of which I also upgraded to use the latest Date Feed API instead of the now-deprecated Calendar Feed API), so that should be the same as if I had deleted the old View and re-built it using the new Wizard. When I get a chance (this is a production site so I don’t want to risk the error coming up on the home page for any longer than I absolutely have to), I’ll re-update to rc1 and see if that fixes it. If not, I’ll try using the new Date Wizard and re-applying my customizations and see if that fixes it. In both cases, I’ll do several views of several pages to build the cache back up.
At any rate, this would explain why it only happens to some people: those who had Calendars still using the now-deprecated Calendar Items (and other Modules that use now-deprecated techniques), and only on pages using those.
Comment #16
joachim commentedI am seeing this error, and I don't have Calendar module installed. I do have Date module though.
The error was introduced somewhere between betas 3 and 4. Git bisect says:
7457a9dc05f2cfb10e040ab3c59cfaa115d2e34c is the first bad commit
commit 7457a9dc05f2cfb10e040ab3c59cfaa115d2e34c
Author: fabsor
Date: Thu Jan 26 17:52:13 2012 +0200
Issue #1412572: Fixed No access check when referred items are being viewed.
:100644 100644 bb66503fb0f241fad88856f5801a78490eb30a85 e0efa7efcf3a3e69e2a781afd63afab0f1cedfa0 M entityreference.module
Comment #17
davidwhthomas commentedI'm getting a related error:
PHP Fatal error: Interface 'EntityReference_SelectionHandler' not found in .../sites/all/modules/contrib/entityreference/plugins/selection/EntityReference_SelectionHandler_Generic.class.php on line 9entityreference 7.x-1.0-rc1
ctools 7.x-1.0
I notice the Interface is defined in abstract.inc and included in
entityreference.info files[] = plugins/selection/abstract.inc
I'm able to clear a couple of caches with drush, but can't clear the class registry without the fatal error above.
The error occurs when loading any entity with an entityreference field on it.
Perhaps it's an issue with module weight and ctools loading the plugins before entityreference has loaded?
Update:
Bingo, I adjusted the weight of entityreference module to come before ctools ( both were weight 0 )
and that fixed the issue for me.
Hopefully it's ok to keep that weighting... a different fix would be preferable.
Comment #18
davidwhthomas commentedBingo, I adjusted the weight of entityreference module to come before ctools ( both were weight 0 )
and, after drush cc registry, that fixed the issue for me.
However, I then found the error on the entityreference field settings form
"The selected selection handler is broken."
I then reverted the entityreference module weight back to default 0
and cleared all caches
All all was well again.
In summary the steps were
update system set weight = -1 where name = 'entityreference';update system set weight = 0 where name = 'entityreference';Shenanigans, but it fixed the issue for me.
I hope that helps.
DT
Comment #19
jonathan_hunt commentedFWIW, I just got this error on Drupal 7.14 (Commerce Kickstart 7.x-1.8). running Entity Reference 7.x-1.0-rc1. After drush dl, I entered drush en --yes entityreference and got "Fatal error: Interface 'EntityReference_SelectionHandler' not found in /Sites/commerce_kickstart-7.x-1.8/sites/commerce.local/modules/entityreference/plugins/selection/EntityReference_SelectionHandler_Generic.class.php on line 9"
No Date module in this install. I tried to install EntityReference because Commerce Coupon now uses it. Clearing cache fails with the same error. Following @davidwhthomas's steps 1-4 above cleared the error.
Comment #20
BJ___ commentedI had the same error in combination with Commerce Coupon. "drush dis entityreference" says that it disables Entity Reference and Commerce Coupon related modules however Entity Reference remains enabled.
-"Drush cc all"
-Enable Commerce Coupon and friends again.
-"Drush cc all"
And it works ....total Voodoo...
Comment #21
spineless commentedI am getting the following error when I attempt to update the scripts for the database.
Fatal error: Interface 'EntityReference_SelectionHandler' not found in /home/www/sites/all/modules/entityreference/plugins/selection/EntityReference_SelectionHandler_Generic.class.php on line 9
I recently had to update the following modules.
addressfield-7.x-1.0-beta3.tar
commerce_coupon-7.x-1.0-beta5.tar
commerce_features-7.x-1.0-alpha1.tar
devel-7.x-1.3.tar
entity-7.x-1.0-rc3.tar
entityreference-7.x-1.0-rc3.tar
features-7.x-1.0-rc3.tar
privatemsg-7.x-1.3.tar
title-7.x-1.0-alpha3.tar
I am running Drupal 7.14.
I am not sure why I am getting this error. My site appears to work other then this one error.
Is someone working on this?
Thanks,
Spineless
Comment #22
spineless commentedSo I ran the database script again and got a different type of error which crashed the update script routine.
Fatal error: Interface 'EntityReference_SelectionHandler' not found in /home/www/sites/all/modules/entityreference/plugins/selection/EntityReference_SelectionHandler_Generic.class.php on line 9
I did not make any changes but redid the script again. Then the script succeeded but I go thits error as a result.
Update #7004
Failed: PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'site.commerce_coupon_log' doesn't exist: SELECT * FROM {commerce_coupon_log}; Array ( ) in commerce_coupon_update_7004() (line 225 of /home/www/sites/all/modules/commerce_coupon/commerce_coupon.install).
Hope this helps,
Spineless
Comment #23
davidwhthomas commented@spineless,
Did you try my workaround from #18
Re: the coupon_log error looks like your db is in an odd state, you could try wrapping that update hook in if(db_table_exists()) and running again.
Comment #24
spineless commentedThis is interesting......
I am not using drush. Not sure what it does really.... I upload my files via filezilla and access the files via SSH.
I attempted to run the commands you mentioned in #18 but of course they are not standard linux commands so they did not work.
Where would I put the code you have written. Which file? and which line?
Thanks,
Spineless
Comment #25
davidwhthomas commentedCheck the comment above the code, the file / line number info is there. ( // commerce_coupon.install update_7004 line 230 )
P.S If you're on linux, you should find out about drush.
Comment #26
spineless commentedI was able to install drush. I will look into how it works. Thanks a lot. this looks useful.
I updated the code in the commerce coupon.install and the error still exists.
I attempted to do the steps in step 18 above but I am unsure how to do the first couple of steps.
How do I update
mysql update system set weight = -1 where name = 'entity reference';
I typed this is the command line on the server but Ubuntu does not recognize the command update.
I get the error
mysql: unknown option '-1'
Comment #27
chrisschaub commentedI'm getting this error ...
Error: Cannot redeclare class EntityReference_BehaviorHandler_Broken in .../modules/entityreference/plugins/behavior/abstract.inc, line 187
I'm trying to clone the site with aegir. I was able to clone (make a copy) in the past ( a day ago), but now drush is complaining. The workarounds in #18 did not help. I am using date and calendar, but the latest versions, the new approach to calendars using templates and entities.
Also, using Drupal 7.14, entityref 7.1-dev from 7/8. I am also seeing this in the wathdog log:
Notice: Undefined index: controller class in entity_get_controller() (line 7655 of includes/common.inc).
Very weird. Aegir just uses drush to make a copy of the site under a different url. It seems that there is some module weight / registry issue. I've tried all of the stuff above, no workaround works. Drush 4.5.
Comment #28
bendev commentedI have a similar error and the above proposals didn't help
I tried to disable uninstall and reinstall coupon but it didn't help
EntityMetadataWrapperException : Unknown data property commerce_coupon_order_reference. dans EntityStructureWrapper->getPropertyInfo() (ligne 339 dans /sites/all/modules/entity/includes/entity.wrapper.inc).
any idea ?
drupal 7.15
coupon : beta 6
entity reference 7.x-1.0-rc3
thanks a lot !
Comment #29
plonk commentedadding a
at the top of the plugins/selection/EntityReference_SelectionHandler_Generic.class.php file fixed the issue for me. It is a dirty hack, but seemingly including through the files[] array does not work. Core bug?
Comment #30
joachim commented> It is a dirty hack, but seemingly including through the files[] array does not work
You may need http://drupal.org/project/registry_rebuild.
Comment #31
grasmash commented@ #29
Along those lines, I added:
To entityreference.module, just before the offending line (175). So, it ends up being:
Not sure if this is a hint, but I saw this error immediately after clearing cache:
Seems like CTOOLs might load the entity reference plugin BEFORE Drupal has finished bootstrapping file includes for the entityreference module.
Comment #32
socialnicheguru commentedthanks madmatter23.
your one line addition allowed me to continue with the install and I did get the same errors.
Comment #33
plonk commentedMade a patch from #31
Comment #34
plonk commentedEDIT: Oops, forgot to type somthing in the edit field.
@maddmatter23: You may have a different error if I'm not mistaken. Does you Error say something about the BehaviorHandler or the SelectionHandler? On that note, a patch for #29
Comment #35
marc angles commentedI had problem cloning my site in aegir.
In short, it was firing this error
Cannot redeclare class EntityReference_SelectionHandler in modules/entityreference/plugins/selection/abstract.inc, line 10
I applied this patch on 7.x-1.0 and the site is cloning. Thanks a lot
Comment #36
Paul B commentedI get the error from #17 (Class 'EntityReference_SelectionHandler_Generic' not found) with Organic Groups. It works if I add the line
to OgSelectionHandler.class.php.
Comment #37
drvdt commentedBefore every thing are well with me. But It appears again with version 7.x-1.1
Any help?
Comment #38
marcoscanoSame problem here, although in my case none of the solutions indicated above worked. The problem appeared when upgrading from 7.x-1.1 to latest -dev version and running update.php
Comment #39
marc angles commentedTrying to clone a site in aegir I had this error :
Error: Cannot redeclare class SelectionHandler in EntityReference_entityreference/plugins/selection/abstract.inc, line 10
#18 did the trick. Thanks a lot.
Comment #40
psynaptic commentedWe came across this problem and discovered that the entityreference module was disabled without deleting the associated fields.
Comment #41
ndenhild commented#18 did it for me, thanks davidwhthomas, you saved my day!
Comment #42
robloachCleaned up the changes, and included them with __FILE__ rather than module_include, as that wasn't available so early though Drush.
Source: https://github.com/RobLoach/entityreference/tree/patch-1
Comment #43
kclarkson commentedyeah @RobLoach
thanks for the patch love!
confirming that patch from #42 worked for me
Comment #44
socialnicheguru commented42 worked for me also.
Comment #45
ezoulou commentedGreat :-)
Patch #42 work just fine.
I'm using Drupal 7.50 + EntityReference 7.x-1.2.
Thanks for the patch.
Comment #46
tjcvd commentedI have this error
Fatal error: Call to undefined function ctools_include() in /home/sarelres/public_html/sarel/sites/all/modules/contrib/entityreference/entityreference.module on line 194Comment #47
chris matthews commented#43 -
#43 -
#44 -
I believe @tjcvd's error is unrelated to this issue.
Ready for RTBC status?
Comment #48
elusivemind commentedPatch 42 works. I think we can reliably say it is RTBC
Comment #49
nwom commentedPatch #42 worked great. I had the same error when importing an Aegir backup into a new site.
This fixes a long lasting related issue here as well #1680000: Drush / Aegir broken with latest entityreference
Comment #50
irinaz commentedComment #51
joseph.olstadStraight up reroll, just for fuzz and to satisfy the cicd.
Comment #52
alex.skrypnykUpdated patch in #51 with a check for the
$classas it may beNULLComment #54
joseph.olstadThanks to:
plonk,
RobLoach,
alex.skrypnyk,
joseph.olstad,
spineless,
davidwhthomas,
Crell,
Marc Angles,
mrfelton,
Joel MMCC,
SocialNicheGuru,
joachim,
mrconnerton,
Damien Tournoud,
jonathan_hunt,
irinaz, DizzyC,
BJ
shendric
amitaibu
micheas
creativenode
NWOM
tjcvd
psynaptic
ndenhild
Chris Matthews
ezoulou
kclarkson
marcoscano
drvdt
chrisschaub
bendev
ElusiveMind
Paul B
grasmash
Alex Skrypnyk
Comment #55
joseph.olstadhttps://www.drupal.org/project/entityreference/releases/7.x-1.6-rc3
Comment #57
joseph.olstadhttps://www.drupal.org/project/entityreference/releases/7.x-1.7
Comment #58
joseph.olstadplease try the latest release
https://www.drupal.org/project/entityreference/releases/7.x-1.9