Problem/Motivation
OS: Latest windows 10, using Xampp.
Server info: Apache/2.4.38 (Win64) OpenSSL/1.1.1b PHP/7.3.3
Database server: 5.5.5-10.1.38-MariaDB
After migrating from drupal 7 to drupal 8, using the migrate manifest methode*, everthing works as expected, except on part. When i go to 'admin/structure/display-modes/view' and i click edit/delete on 'full' or 'teaser' in the content section, i get a 404 page not found.
*Happens with any migrate methode.
The database logs it as page nout found.
When i go to 'admin/structure/types/manage/article/display' and i click save on the default display, it gives the following error: The website encountered an unexpected error. Please try again later..
The full error log is at the end of the IS
This also happend in the latest 8.6.x release.
Steps to reproduce
TBA.
What contrib modules were installed on the sites that have this problem?
Proposed resolution
TBD
Remaining tasks
Determine the source of the problem. Ideally, provide the source database data that causes this to happen.
User interface changes
N/A
API changes
N/A
Data model changes
N/A
Release notes snippet
N/A
The database log gives the following detailed error log
Notice: Undefined index: teaser in Drupal\field_ui\Form\EntityDisplayFormBase->saveDisplayStatuses() (line 907 of H:\xampp\htdocs\d88\core\modules\field_ui\src\Form\EntityDisplayFormBase.php) #0 H:\xampp\htdocs\d88\core\includes\bootstrap.inc(587): _drupal_error_handler_real(8, 'Undefined index...', 'H:\\xampp\\htdocs...', 907, Array) #1 H:\xampp\htdocs\d88\core\modules\field_ui\src\Form\EntityDisplayFormBase.php(907): _drupal_error_handler(8, 'Undefined index...', 'H:\\xampp\\htdocs...', 907, Array) #2 H:\xampp\htdocs\d88\core\modules\field_ui\src\Form\EntityDisplayFormBase.php(584): Drupal\field_ui\Form\EntityDisplayFormBase->saveDisplayStatuses(Array) #3 [internal function]: Drupal\field_ui\Form\EntityDisplayFormBase->submitForm(Array, Object(Drupal\Core\Form\FormState)) #4 H:\xampp\htdocs\d88\core\lib\Drupal\Core\Form\FormSubmitter.php(111): call_user_func_array(Array, Array) #5 H:\xampp\htdocs\d88\core\lib\Drupal\Core\Form\FormSubmitter.php(51): Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object(Drupal\Core\Form\FormState)) #6 H:\xampp\htdocs\d88\core\lib\Drupal\Core\Form\FormBuilder.php(590): Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object(Drupal\Core\Form\FormState)) #7 H:\xampp\htdocs\d88\core\lib\Drupal\Core\Form\FormBuilder.php(319): Drupal\Core\Form\FormBuilder->processForm('entity_view_dis...', Array, Object(Drupal\Core\Form\FormState)) #8 H:\xampp\htdocs\d88\core\lib\Drupal\Core\Controller\FormController.php(93): Drupal\Core\Form\FormBuilder->buildForm('entity_view_dis...', Object(Drupal\Core\Form\FormState)) #9 [internal function]: Drupal\Core\Controller\FormController->getContentResult(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\RouteMatch)) #10 H:\xampp\htdocs\d88\core\lib\Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array) #11 H:\xampp\htdocs\d88\core\lib\Drupal\Core\Render\Renderer.php(582): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #12 H:\xampp\htdocs\d88\core\lib\Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure)) #13 H:\xampp\htdocs\d88\core\lib\Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) #14 H:\xampp\htdocs\d88\vendor\symfony\http-kernel\HttpKernel.php(151): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #15 H:\xampp\htdocs\d88\vendor\symfony\http-kernel\HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) #16 H:\xampp\htdocs\d88\core\lib\Drupal\Core\StackMiddleware\Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #17 H:\xampp\htdocs\d88\core\lib\Drupal\Core\StackMiddleware\KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #18 H:\xampp\htdocs\d88\core\modules\page_cache\src\StackMiddleware\PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #19 H:\xampp\htdocs\d88\core\modules\page_cache\src\StackMiddleware\PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true) #20 H:\xampp\htdocs\d88\core\lib\Drupal\Core\StackMiddleware\ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #21 H:\xampp\htdocs\d88\core\lib\Drupal\Core\StackMiddleware\NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #22 H:\xampp\htdocs\d88\vendor\stack\builder\src\Stack\StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #23 H:\xampp\htdocs\d88\core\lib\Drupal\Core\DrupalKernel.php(693): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #24 H:\xampp\htdocs\d88\index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #25 {main}.
error 2:
Error: Call to a member function getConfigDependencyName() on null in Drupal\Core\Entity\EntityDisplayBase->calculateDependencies() (line 314 of H:\xampp\htdocs\d88\core\lib\Drupal\Core\Entity\EntityDisplayBase.php) #0 H:\xampp\htdocs\d88\core\lib\Drupal\Core\Config\Entity\ConfigEntityBase.php(319): Drupal\Core\Entity\EntityDisplayBase->calculateDependencies() #1 H:\xampp\htdocs\d88\core\lib\Drupal\Core\Entity\EntityDisplayBase.php(266): Drupal\Core\Config\Entity\ConfigEntityBase->preSave(Object(Drupal\Core\Config\Entity\ConfigEntityStorage)) #2 H:\xampp\htdocs\d88\core\lib\Drupal\Core\Entity\EntityStorageBase.php(490): Drupal\Core\Entity\EntityDisplayBase->preSave(Object(Drupal\Core\Config\Entity\ConfigEntityStorage)) #3 H:\xampp\htdocs\d88\core\lib\Drupal\Core\Entity\EntityStorageBase.php(445): Drupal\Core\Entity\EntityStorageBase->doPreSave(Object(Drupal\Core\Entity\Entity\EntityViewDisplay)) #4 H:\xampp\htdocs\d88\core\lib\Drupal\Core\Config\Entity\ConfigEntityStorage.php(263): Drupal\Core\Entity\EntityStorageBase->save(Object(Drupal\Core\Entity\Entity\EntityViewDisplay)) #5 H:\xampp\htdocs\d88\core\lib\Drupal\Core\Entity\EntityBase.php(394): Drupal\Core\Config\Entity\ConfigEntityStorage->save(Object(Drupal\Core\Entity\Entity\EntityViewDisplay)) #6 H:\xampp\htdocs\d88\core\lib\Drupal\Core\Config\Entity\ConfigEntityBase.php(613): Drupal\Core\Entity\EntityBase->save() #7 H:\xampp\htdocs\d88\core\modules\field_ui\src\Form\EntityDisplayFormBase.php(910): Drupal\Core\Config\Entity\ConfigEntityBase->save() #8 H:\xampp\htdocs\d88\core\modules\field_ui\src\Form\EntityDisplayFormBase.php(584): Drupal\field_ui\Form\EntityDisplayFormBase->saveDisplayStatuses(Array) #9 [internal function]: Drupal\field_ui\Form\EntityDisplayFormBase->submitForm(Array, Object(Drupal\Core\Form\FormState)) #10 H:\xampp\htdocs\d88\core\lib\Drupal\Core\Form\FormSubmitter.php(111): call_user_func_array(Array, Array) #11 H:\xampp\htdocs\d88\core\lib\Drupal\Core\Form\FormSubmitter.php(51): Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object(Drupal\Core\Form\FormState)) #12 H:\xampp\htdocs\d88\core\lib\Drupal\Core\Form\FormBuilder.php(590): Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object(Drupal\Core\Form\FormState)) #13 H:\xampp\htdocs\d88\core\lib\Drupal\Core\Form\FormBuilder.php(319): Drupal\Core\Form\FormBuilder->processForm('entity_view_dis...', Array, Object(Drupal\Core\Form\FormState)) #14 H:\xampp\htdocs\d88\core\lib\Drupal\Core\Controller\FormController.php(93): Drupal\Core\Form\FormBuilder->buildForm('entity_view_dis...', Object(Drupal\Core\Form\FormState)) #15 [internal function]: Drupal\Core\Controller\FormController->getContentResult(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\RouteMatch)) #16 H:\xampp\htdocs\d88\core\lib\Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array) #17 H:\xampp\htdocs\d88\core\lib\Drupal\Core\Render\Renderer.php(582): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #18 H:\xampp\htdocs\d88\core\lib\Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure)) #19 H:\xampp\htdocs\d88\core\lib\Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) #20 H:\xampp\htdocs\d88\vendor\symfony\http-kernel\HttpKernel.php(151): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #21 H:\xampp\htdocs\d88\vendor\symfony\http-kernel\HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) #22 H:\xampp\htdocs\d88\core\lib\Drupal\Core\StackMiddleware\Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #23 H:\xampp\htdocs\d88\core\lib\Drupal\Core\StackMiddleware\KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #24 H:\xampp\htdocs\d88\core\modules\page_cache\src\StackMiddleware\PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #25 H:\xampp\htdocs\d88\core\modules\page_cache\src\StackMiddleware\PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true) #26 H:\xampp\htdocs\d88\core\lib\Drupal\Core\StackMiddleware\ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #27 H:\xampp\htdocs\d88\core\lib\Drupal\Core\StackMiddleware\NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #28 H:\xampp\htdocs\d88\vendor\stack\builder\src\Stack\StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #29 H:\xampp\htdocs\d88\core\lib\Drupal\Core\DrupalKernel.php(693): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #30 H:\xampp\htdocs\d88\index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #31 {main}.
This also happend in the latest 8.6.x release.
Comments
Comment #2
cilefen commentedComment #3
xjmComment #4
nchase commentedsame problem here. Upgrade from 7.67 to 8.7.7. Can't save the "manage display" page. Always throws an error: The website encountered an unexpected error. Please try again later..
Php log as follows:
Comment #5
demon326 commented@Nchase:
I think i narrowed this down to the following source:
When you migrate, it takes all the view mods from drupal 7, including the settins from it. That also includes settings from modules that hook into the view modes, but those modules are missing from D8 and thus the error.
Trie to disable and uninstall all the modules that allow you to change the view mode. for examle panels, displaysuite, AMP(google) and so on.
I have not tested this, but thats what i concluded after a bit of research.
Comment #7
pyretta commentedHi,
I have found another solution: vuil has created a patch for a very similar error message. This helps me to solve this problem without having to migrate again and possibly lose modifications already made.
I have/had also installed the module "Display Suite" in Drupal 7. It is possible that it is actually related to it. But as I said, it would mean uninstalling the module in Drupal 7 first, performing the migration again and losing data.
The patch allows to bypass this step. Tested with Drupal 8.8.2 - PHP 7.2.
Here is the link to his patch, what helped me: https://www.drupal.org/project/drupal/issues/3062441#comment-13338303
Hopefully it helps you too.
Best regards
Comment #8
demon326 commented@pyretta
Thanks for the tip, it seems to be working.
Comment #10
irous commentedHi, I've had the same problem. I migrated from Drupal 7 to 8, and doing things with display modes was causing the same critical errors as in this thread. Really frustrating. I used the patch mentioned in #7 and that sorta helped with some content types, but not all. I feel #5 and #7 is spot on, some settings have carried on from Drupal 7 that are messing with the Drupal 8 site - and I'm pretty sure the main culprit is Display Suite too. My main issues were with the Full and Teaser display types which I had configured in Display Suite in D7 that migrated across to the D8 site and was causing these errors.
My suggestion is to completely uninstall Display Suite on your Drupal 7 site before you make the migration to Drupal 8. However, I had done a lot of work already and didn't want to migrate again and lose that work, but I managed to get rid of all the errors I’ve had with this by making these changes to my D8 database.
Please backup your database before you attempt any of this.
So, in the database, go to the "config" table, search for “teaser” (SELECT * FROM `config` WHERE `name` LIKE ‘%teaser%’) and delete all the rows it finds. They should be like “core.entity_view_display.node.[content-type].teaser". Also deleted “core.entity_view_mode.node.teaser”. The “Teaser” display mode type is still not gone, however, and I could never delete it via “admin/structure/display-modes/view” like comment #4 mentioned, so I went to the db table “key_value” and searched for teaser anywhere in the value field (SELECT * FROM `key_value` WHERE `value` LIKE '%teaser%’). I deleted all the entries it found there (core.entity_view_display.node.news.teaser, core.entity_view_mode.node.teaser). I had to then clear the cache, and then I was able go to “admin/structure/display-modes/view” and create a new Teaser display mode.
Now the other display mode type that was causing problems was “Full”. I did the same as what I did for Teaser, which was go to the “config” table and search for full (SELECT * FROM `config` WHERE `name` LIKE '%full%’) and deleted all that it found (core.entity_view_display.node.[content-type].full, core.entity_view_mode.user.full). Then I went to the “key_value” table, and searched for “full” there (SELECT * FROM `key_value` WHERE `value` LIKE '%full%’). Now, I only deleted the rows it found like (config.entity.key_store.entity_view_display, config.entity.key_store.entity_view_mode) - I didn’t remove “entity.definitions.installed”. Then I cleared the site’s cache, and then I went to “admin/structure/display-modes/view” and I can see the Full display mode type is gone and I could create a new “Full” view mode type.
After this, I can go to any content type and adjust their Custom display settings (selecting/deselecting Full or Teaser for both) without seeing any errors, or adding a Layout Builder for that content type without seeing any errors which I was seeing previously. If you created a display mode type that was something else other than Full or Teaser, you’ll need to search for whatever that is in the tables mentioned previously instead.
Comment #11
pyretta commentedIn case someone stumbles upon this error again, just by another event, like it happened to me now.... The error doesn't seem to be limited to changing/adding a display mode. It can apparently also appear when adding new fields, for example. At least that's how it happened to me - now with Drupal 8.9.13 (PHP 7.4).
A slightly modified patch has also helped me here:
https://www.drupal.org/project/drupal/issues/3062441#comment-13896171
It implements a new Logger for watchdog which gives information about the possible affected display mode.
In my case it was a PDF display mode.
Hopefully it will help someone else as well.
Comment #12
quietone commentedComment #13
quietone commentedReading through the issue it seems that the comment in #5 is the most likely, that there are view modes from contrib that are causing the problem. But I could be wrong. I just have questions.
What contrib modules that provide view modes were installed on the source site?
Can anyone provide an example of the source data that you think is causing this?
Is the data corrupt or does the migration not handle a case that it should?
In making a patch for this a test will be needed and to do that the source database fixture needs to include a case that causes this problem. Any insights into that will help.
Postponing on more information.
Comment #14
demon326 commentedI created this issue a few years ago when migrating my site from drupal 7 to 8. And it is indeed view mode from a module that are causing this issue. I 'fixed' the issue by using the following patch:https://www.drupal.org/files/issues/2019-11-04/3062441-5.patch It makes the site working.
Only when i enable a new module, i get the following message:
I'm not really sure what modules caused issue, but when i was testing the migration i took notes and those mention the following addons:
"Simple news, panels, display suite, amp" I also remember that i had to delete the simple_news tables from the database, even after uninstalling the module.
I still have a copy of my drupal 7 database that i could provide for testing.
Comment #18
quietone commented@demon326, thanks for the reply. The error messages are very helpful. It is clear that the problem is related to comments, specifically the bundles. I think this problem is that same as #3005718: D7 comment migration does not properly migrate fields by comment bundle. and I am closing this as a duplicate. I am moving credit over there too.
Cheers,