Since a day or two, I'm suddenly getting errors in a custom test I'm running on a contrib module which exposes a plugin for Rabit hole.
The error on the test bot is this: Exception: TypeError: Argument 1 passed to Drupal\rabbit_hole\Plugin\RabbitHoleBehaviorPluginBase::performAction() must be an instance of Drupal\Core\Entity\Entity, instance of Drupal\node\Entity\Node given, called in /var/www/html/modules/contrib/rabbit_hole/src/BehaviorInvoker.php on line 126
Drupal\rabbit_hole\Plugin\RabbitHoleBehaviorPluginBase->performAction()() (Line: 17)
Weird thing, I can't reproduce this locally, the test runs fine then.
Example failure on the testbot: https://dispatcher.drupalci.org/job/drupal_contrib/343162/testReport/jun...
Just letting you know, not exactly sure what goes wrong here.
| Comment | File | Size | Author |
|---|---|---|---|
| #25 | 3038539-25.patch | 8.24 KB | isa.bel |
| #25 | 3038539-25.patch | 8.24 KB | isa.bel |
| #24 | 3038539-24.patch | 9.26 KB | isa.bel |
| #22 | rabbitHoleSettings.jpg | 243.82 KB | akshita |
| #5 | 3038539-5.patch | 7.81 KB | jibran |
Comments
Comment #2
mishac commentedI started having a very similar issue, but in a different function, when I updated to drupal 8.7-alpha1:
TypeError: Argument 2 passed to Drupal\rabbit_hole\FormManglerService::addRabbitHoleOptionsToEntityForm() must be an instance of Drupal\Core\Entity\Entity, instance of Drupal\node\Entity\Node given, called in /app/web/modules/contrib/rabbit_hole/rabbit_hole.module on line 68 in Drupal\rabbit_hole\FormManglerService->addRabbitHoleOptionsToEntityForm() (line 81 of modules/contrib/rabbit_hole/src/FormManglerService.php).Comment #3
mishac commentedHere's a patch that fixes the issue for me, on beta 5.
Comment #4
jibranHere is the patch to fix the issue described in IS and #2
Comment #5
jibranMissed couple of usages.
Comment #6
mishac commentedAfter a few min of testing, patch in #5 works for me so far with 1.x-dev on Drupal 8.7.0-alpha-1. No more WSoDs!
Comment #7
jibranOk, can we mark this RTBC?
Comment #8
upchuk commentedYeah, this is happening because of #1883744: Convert Entity to EntityBase for consistency with ContentEntityBase and ConfigEntityBase. So makes sense to always type-hint the interface rather than a base class.
The patch looks good.
Comment #9
drcolossos commentedWorks as expected! RTBC!
Comment #10
WidgetsBurritos commented+1, I can also confirm the patch in #5 resolves this issue.
Comment #12
dylan donkersgoed commentedI merged this in, thanks for the patch.
Comment #13
train commentedJust for giggles I manually applied these changes to 1.0-beta5 and they worked in D8.7.0.
Comment #14
adrianm6254 commentedI was able to apply 3038539-5.patch successfully on D8.7.0.
Works like a charm.
Comment #15
markdorisonUpdating to Drupal 8.7.0 without this patch applied resulted in a PHP error. I can confirm that this patch resolved the error, which I will include here for searchability:
TypeError: Argument 1 passed to Drupal\rabbit_hole\Plugin\RabbitHoleBehaviorPluginBase::performAction() must be an instance of Drupal\Core\Entity\Entity, instance of Drupal\node\Entity\Node given, called in /app/web/modules/contrib/rabbit_hole/src/BehaviorInvoker.php on line 126 in Drupal\rabbit_hole\Plugin\RabbitHoleBehaviorPluginBase->performAction() (line 17 of /app/web/modules/contrib/rabbit_hole/src/Plugin/RabbitHoleBehaviorPluginBase.php) #0Could a new release be cut with this latest fix? I bet it would eliminate a lot of confusion for users upgrading Drupal core.
Comment #16
shepparddigital commentedI updated 7 sites to 8.7.0 last night, and this issue occurred on all of them. I can confirm this patch resolved the issue.
If this problem was apparent during earlier versions, why didn't this patch make it into the latest release? It would have avoided all of this confusion.
Comment #17
anybodyThank you! New beta6 release would be nice because 8.7 is out and everyone using it will run into the problem! Is that possible?
Comment #18
hugovk commentedRabbit Hole 8.x-1.0-beta6 has been released with this fix. I've verified the fix with Drupal 8.7. Thanks all!
https://www.drupal.org/project/rabbit_hole/releases/8.x-1.0-beta6
Comment #19
anybodyThanks!!
Comment #21
akshita commentedAfter upgrading to 8.7.1, I ended up with the below error:
The website encountered an unexpected error. Please try again later.
TypeError: Argument 1 passed to Drupal\rabbit_hole\Plugin\RabbitHoleBehaviorPluginBase::performAction() must be an instance of Drupal\Core\Entity\Entity, instance of Drupal\node\Entity\Node given, called in /var/www/docroot/modules/contrib/rabbit_hole/src/BehaviorInvoker.php on line 126 in Drupal\rabbit_hole\Plugin\RabbitHoleBehaviorPluginBase->performAction() (line 17 of modules/contrib/rabbit_hole/src/Plugin/RabbitHoleBehaviorPluginBase.php).
The above patch helped me to get rid off of the error message and the site was up but "Rabbit Hole settings" @page redirect is not working anymore. I tried the other options but none of them were working.
Here is the redirect path: [media:field_media_file:entity:url] (redirecting the entity page to the file)
Any help is appreciated.
Comment #22
akshita commentedComment #23
mturner20 commentedI can confirm that the patch from #5 worked for me on version 8.x-1.x-dev! Thanks jibran!
Comment #24
isa.belHello everyone,
Even tho this issue is fixed, for me this problem wasn't solve by updating rabbit_hole module and I'm on Drupal version 8.7.3.
So, I've tried to apply the patch from #5 and it gave me some conflicts.
Then I've made some changes on it, that's why I'm uploading it here.
Hope it helps someone else.
Thank you.
Comment #25
isa.belApologies, disregard #24. Added diffs not related to this module.
Comment #26
stevenx commentedUpgrade to rabbit_hole:^1.0 fixed it for me
Comment #27
zyla commentedSame for me, upgrade rabbit_hole to 1.0.0-beta6 fixed it.
Comment #28
Gnanasampandan Velmurgan commentedAfter upgrading drupal core to 8.7.6, I ended up with the below error:
TypeError: Argument 2 passed to Drupal\rabbit_hole\FormManglerService::addRabbitHoleOptionsToEntityForm() must be an instance of Drupal\Core\Entity\Entity, instance of Drupal\node\Entity\Node given, called in /var/www/html/modules/rabbit_hole/rabbit_hole.module on line 67 in Drupal\rabbit_hole\FormManglerService->addRabbitHoleOptionsToEntityForm() (line 81 of /var/www/html/modules/rabbit_hole/src/FormManglerService.php) #0 /var/www/html/modules/rabbit_hole/rabbit_hole.module(67): Drupal\rabbit_hole\FormManglerService->addRabbitHoleOptionsToEntityForm(Array, Object(Drupal\node\Entity\Node), Object(Drupal\Core\Form\FormState), 'node_one_column...') #1 /var/www/html/core/lib/Drupal/Core/Extension/ModuleHandler.php(539): rabbit_hole_form_alter(Array, Object(Drupal\Core\Form\FormState), 'node_one_column...') #2 /var/www/html/core/lib/Drupal/Core/Form/FormBuilder.php(835):
The above #5 patch helped me works as perfect.
Comment #29
rakesh.gectcrMe too got the same error after updating the Drupal core to 8.7.x
my module version was
"drupal/rabbit_hole": "^1.0@beta",Updated the module to rabbit_hole 8.x-1.0-beta6 Helps me to resolve the issue.
Comment #30
shreya_r commentedI updated from Drupal 8.6.17 to 8.7.7.
I got this error and I wasn't able to edit content-
TypeError: Argument 2 passed to Drupal\rabbit_hole\FormManglerService::addRabbitHoleOptionsToEntityForm() must be an instance of Drupal\Core\Entity\Entity, instance of Drupal\node\Entity\Node given, called in /app/web/modules/contrib/rabbit_hole/rabbit_hole.module on line 68 in Drupal\rabbit_hole\FormManglerService->addRabbitHoleOptionsToEntityForm() (line 81 of modules/contrib/rabbit_hole/src/FormManglerService.php)Upgrade to rabbit_hole:^1.0 fixed it for me
Comment #31
davi.uezono commentedI was using Drupal 8.6.17 and rabbit_hole 1.0-beta4.
I've just updated to Drupal 8.7.11 and that's when I got to this error.
Upgrading it to 1.0-beta6 solved everything.