The following warning comes up after I put a class onto a block inside the region:
Notice: Undefined index: theme in Drupal\context\Reaction\Blocks\BlockCollection->getAllByRegion() (line 37 of modules/contrib/context/src/Reaction/Blocks/BlockCollection.php).
Drupal\context\Reaction\Blocks\BlockCollection->getAllByRegion('acf_enterprise') (Line: 148)
Drupal\context\Plugin\ContextReaction\Blocks->execute(Array, Object, Array) (Line: 109)
Drupal\context\Plugin\DisplayVariant\ContextBlockPageVariant->build() (Line: 259)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 117)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object)
call_user_func(Array, Object, 'kernel.view', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.view', Object) (Line: 156)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 50)
Drupal\ban\BanMiddleware->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 694)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)Also, this appears on the /admin/structure/context page:
Notice: Undefined index: theme in Drupal\context\ContextManager->getActiveReactions() (line 231 of modules/contrib/context/src/ContextManager.php).
Drupal\context\ContextManager->getActiveReactions() (Line: 44)
Drupal\context\EventSubscriber\BlockPageDisplayVariantSubscriber->onSelectPageDisplayVariant(Object, 'render.page_display_variant.select', Object)
call_user_func(Array, Object, 'render.page_display_variant.select', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('render.page_display_variant.select', Object) (Line: 209)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 117)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object)
call_user_func(Array, Object, 'kernel.view', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.view', Object) (Line: 156)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 50)
Drupal\ban\BanMiddleware->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 694)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Notice: Undefined index: theme in Drupal\context\ContextManager->getActiveReactions() (line 231 of modules/contrib/context/src/ContextManager.php).
Drupal\context\ContextManager->getActiveReactions() (Line: 44)
Drupal\context\EventSubscriber\BlockPageDisplayVariantSubscriber->onSelectPageDisplayVariant(Object, 'render.page_display_variant.select', Object)
call_user_func(Array, Object, 'render.page_display_variant.select', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('render.page_display_variant.select', Object) (Line: 209)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 117)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object)
call_user_func(Array, Object, 'kernel.view', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.view', Object) (Line: 156)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 50)
Drupal\ban\BanMiddleware->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 694)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Notice: Undefined index: theme in Drupal\context\ContextManager->getActiveReactions() (line 231 of modules/contrib/context/src/ContextManager.php).
Drupal\context\ContextManager->getActiveReactions() (Line: 44)
Drupal\context\EventSubscriber\BlockPageDisplayVariantSubscriber->onSelectPageDisplayVariant(Object, 'render.page_display_variant.select', Object)
call_user_func(Array, Object, 'render.page_display_variant.select', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('render.page_display_variant.select', Object) (Line: 209)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 117)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object)
call_user_func(Array, Object, 'kernel.view', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.view', Object) (Line: 156)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 50)
Drupal\ban\BanMiddleware->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 694)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)| Comment | File | Size | Author |
|---|---|---|---|
| #10 | 3122023-4.0-beta2.patch | 3.01 KB | niles38 |
Issue fork context-3122023
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
niles38 commentedComment #3
niles38 commentedThese kinds of errors seem to be everywhere with this module:
Comment #4
niles38 commentedComment #5
nace_fr commentedHi. I have tried to reproduce this, but with no success. My logs are clear and there are no warnings/errors. Could you post a more detailed description of this issue and how to reproduce it?
Comment #6
niles38 commentedHi. I'll do this step by step:
I went into Structure --> Context --> (selected one of my pre-existing contexts). I have a condition of Term which is set to a term in one of my vocabularies. Then Reactions of type Blocks. I need to add a class onto a block in order to differentiate it since if I place the same block in different regions (for menus), it always uses the same template. There is no good way to differentiate the templates so I add a Block Class on the block.
Adding this Block Class spawns the above errors.
I modified this module locally to solve the issues.
Here's what I did:
On /modules/contrib/context/src/Reaction/Blocks/BlockCollection.php line 37:
if (isset($configuration['theme']) && ($configuration['theme'] !== $theme)) {On /modules/contrib/context/src/Plugin/ContextReaction/Blocks.php line 190 - 201:
On /modules/contrib/context/src/Plugin/ContextReaction/Blocks.php line 222 - 239:
On /modules/contrib/context/src/ContextManager.php line 231:
if ((isset($block->getConfiguration()['theme'])) && ($block->getConfiguration()['theme'] == $current_theme)) {There could be a better way to solve the issues but PHP on my local (and all our local environments and our dev server) does not like calling indexes that aren't set.
I'm going to see if I can create a patch for the above since this is a major issue as it's clogging up all our logs on all our local environments and our dev. Plus it produces these errors above on every page.
Comment #7
niles38 commentedBy the way, I'm running Drupal 8.8.4 with PHP 7.3.1.
Comment #8
niles38 commentedAdding patch that goes on 8.x-4.x using 8.x-4.x-dev.
By the way, using the new dev release, I'm getting the following error on most of my site now:
As it is now, I cannot use the new 8.x-4.x-dev release.
Comment #9
klonosHere's another one (Drupal 8.8.1 - PHP 7.2.23):
Comment #10
niles38 commentedMy team is getting frustrated with the errors so I created a patch for the current version (8.x-4.0-beta2) of this module. The current dev version of this module does not work on our end. The patch listed in #8 is for the dev version.
Here is the patch for the 8.x-4.0-beta2 version.
Comment #11
deaom commentedIs this issue still present for the dev branch? I can not reproduce it on core 9.0.2 or 8.9.2. And the patch does not apply, because there were a lot of changes/commits made to dev and needs a re-roll if the patch is still needed. For the beta2 I can also not reproduce it on 8.9.2.
Comment #12
niles38 commentedThe dev branch didn't even work for us so I didn't bother. Half the site was errors.
You can see in the code where PHP would complain about undefined indexes. I think the developers need to go through their code to make sure these indexes are defined before they use them.
Check your log as well. PHP warnings might not be showing up.
Comment #14
deaom commentedI tried applying the patch for the dev version which did not apply anymore (there has been some changes to dev branch), so even tough I could not reproduce the issue even with all my notifications/warnings enabled (my logs are empty) I did "re-rolled" the patch for the latest dev version, as it's better to handle those kind of notices. There has been some major code changes so checked manually for any undefined indexes and I think there are none left. But of course I could be wrong, so marking this issue as needs review. Did create a new fork, just for better organization and easier testing. Of course credit goes to @niles38.
Comment #15
niles38 commentedThanks for the update. We haven't updated Context in a while since these errors were popping up everywhere. I'll check it out for the next round of updates.
Thanks @DeaOm.
Comment #16
paulocsHey @niles38,
About comment #8, did you run update.php after upgrade the module?
I'll commit #13 but please let me know if it solves your problem.
Comment #18
paulocsComment #20
niles38 commented@paulocs, thanks for your updates with this but unfortunately they failed. This isn't fixed yet.
We are receiving the following errors:
I'm going to see if I can change the ticket status to not fixed.
Comment #21
deaom commentedHi @niles38, as far as I can see this is a new error, as it can also be seen from the above logs. Can you just open a new issue with this custom_id issue? And also steps to reproduce, as the error line reported does not match with what is currently committed to dev branch and I'm currently not sure if this is a bigger issue, as it seems this is the line that causes you problems:
'#id' => $block->getConfiguration()['custom_id'],Comment #22
niles38 commentedOkay. Thanks. I'll check it out. My teammate pointed the error out so I will open up a new issue once I verify.
Thanks to all for fixing the PHP warnings!
Comment #23
randell commented@niles38, I can't see a new ticket regarding the custom_id error. Were you able to fix it by any chance?
Comment #24
niles38 commentedCheck out this one: https://www.drupal.org/project/context/issues/3204399