Hi,

After I have been installed Display Suite and Layout plugin, 4 modules have been enabled: Display Suite, Display Suite Extras, Display Suite Switch View Mode, Layout Plugin, but it has been an error written on the Extend page:

Error is a PHP notice only:
------------------------------

Notice: Undefined index: ds_switch in Drupal\Core\Entity\Sql\SqlContentEntityStorage->loadFromSharedTables() (line 554 of core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).
Drupal\Core\Entity\Sql\SqlContentEntityStorage->loadFromSharedTables(Array, Array) (Line: 481)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->mapFromStorageRecords(Array) (Line: 433)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->getFromStorage(Array) (Line: 399)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->doLoadMultiple(Array) (Line: 242)
Drupal\Core\Entity\EntityStorageBase->loadMultiple(Array) (Line: 212)
Drupal\Core\Entity\EntityStorageBase->load('1') (Line: 186)
Drupal\Core\Session\AccountProxy->loadUserEntity('1') (Line: 54)
Drupal\Core\Session\AccountProxy->getAccount() (Line: 75)
Drupal\Core\Session\AccountProxy->getRoles() (Line: 115)
Drupal\locale\LocaleLookup->getCid() (Line: 327)
Drupal\Core\Cache\CacheCollector->lazyLoadCache() (Line: 143)
Drupal\Core\Cache\CacheCollector->get('Content type') (Line: 118)
Drupal\locale\LocaleTranslation->getStringTranslation('hu', 'Content type', '') (Line: 97)
Drupal\Core\StringTranslation\TranslationManager->getStringTranslation('hu', 'Content type', '') (Line: 145)
Drupal\Core\StringTranslation\TranslationManager->doTranslate('Content type', Array) (Line: 117)
Drupal\Core\StringTranslation\TranslationManager->translateString(Object) (Line: 199)
Drupal\Core\StringTranslation\TranslatableMarkup->render() (Line: 15)
Drupal\Core\StringTranslation\TranslatableMarkup->__toString() (Line: 681)
Drupal\Core\Entity\EntityType->getBundleLabel() (Line: 1156)
Drupal\Core\Entity\ContentEntityBase::baseFieldDefinitions(Object) (Line: 329)
Drupal\node\Entity\Node::baseFieldDefinitions(Object) (Line: 204)
Drupal\Core\Entity\EntityFieldManager->buildBaseFieldDefinitions('node') (Line: 171)
Drupal\Core\Entity\EntityFieldManager->getBaseFieldDefinitions('node') (Line: 134)
Drupal\Core\Entity\EntityManager->getBaseFieldDefinitions('node') (Line: 70)
Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem::propertyDefinitions(Object) (Line: 116)
Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem::schema(Object) (Line: 634)
Drupal\Core\Field\BaseFieldDefinition->getSchema() (Line: 657)
Drupal\Core\Field\BaseFieldDefinition->getColumns() (Line: 189)
Drupal\Core\Entity\Sql\DefaultTableMapping->getColumnNames('entity_id') (Line: 532)
Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema->getEntitySchema(Object, ) (Line: 18)
Drupal\comment\CommentStorageSchema->getEntitySchema(Object) (Line: 1171)
Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema->createSharedTableSchema(Object, NULL) (Line: 1091)
Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema->performFieldSchemaOperation('create', Object) (Line: 386)
Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema->onFieldStorageDefinitionCreate(Object) (Line: 1397)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->Drupal\Core\Entity\Sql\{closure}() (Line: 1452)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->wrapSchemaException(Object) (Line: 1398)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->onFieldStorageDefinitionCreate(Object) (Line: 74)
Drupal\Core\Field\FieldStorageDefinitionListener->onFieldStorageDefinitionCreate(Object) (Line: 409)
Drupal\Core\Entity\EntityManager->onFieldStorageDefinitionCreate(Object) (Line: 169)
Drupal\Core\Entity\EntityDefinitionUpdateManager->installFieldStorageDefinition('ds_switch', 'comment', 'ds_switch_view_mode', Object) (Line: 231)
Drupal\Core\Extension\ModuleInstaller->install(Array, 1) (Line: 83)
Drupal\Core\ProxyClass\Extension\ModuleInstaller->install(Array) (Line: 171)
Drupal\system\Form\ModulesListConfirmForm->submitForm(Array, Object)
call_user_func_array(Array, Array) (Line: 111)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 51)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 583)
Drupal\Core\Form\FormBuilder->processForm('system_modules_confirm_form', Array, Object) (Line: 314)
Drupal\Core\Form\FormBuilder->buildForm('system_modules_confirm_form', Object) (Line: 74)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 574)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
call_user_func_array(Object, Array) (Line: 139)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 62)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 98)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 77)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 628)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
---------------------------------------------

Details:
----------
project: 'ds'
version: '8.x-2.3'
---
project: layout_plugin
version: 8.x-1.0-alpha22
--
Drupal Core: 8.1.1
--
PHP version: 7.0.6
Web-Server nginx 1.10

CommentFileSizeAuthor
#5 2734855-5.patch662 bytesAnonymous (not verified)
#4 2016-11-08_142330.png121.83 KBAnonymous (not verified)
#3 ds_switch_message.txt3.89 KBABaier
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

iszabi created an issue. See original summary.

aspilicious’s picture

Version: 8.x-2.4 » 8.x-2.x-dev
Status: Active » Postponed (maintainer needs more info)

Can you try a reinstall?

ABaier’s picture

FileSize
3.89 KB

I can confirm this notice after the installation of Display Suite Switch View Mode. Uninstalling and installing the latest dev of display suite did not solve the problem. I attached my (slightely different) notice also. After starting the installation a whitescreen with the php notice appears before fetching translations.

Drupal 8.1.7
ds 8.x-2.5+8-dev
layout_plugin 8.x-1.0-alpha22+7-dev

php 5.6.10
apache (MAMP)

Anonymous’s picture

Status: Postponed (maintainer needs more info) » Needs work
FileSize
121.83 KB

Confrim for 8.2.2. Reproduce: install (or uninstall and install again) module "Display Suite Switch View Mode".

( ! ) Notice: Undefined index: ds_switch in PATH/TO/SITE/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php on line 568
Call Stack
#	Time	Memory	Function	Location
1	0.0008	363376	{main}( )	...\index.php:0
2	0.0288	1713544	Drupal\Core\DrupalKernel->handle( )	...\index.php:19
3	0.0907	3973504	Stack\StackedHttpKernel->handle( )	...\DrupalKernel.php:652
4	0.0907	3973504	Drupal\Core\StackMiddleware\NegotiationMiddleware->handle( )	...\StackedHttpKernel.php:23
5	0.0908	3973536	Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle( )	...\NegotiationMiddleware.php:50
6	0.0908	3973536	Drupal\page_cache\StackMiddleware\PageCache->handle( )	...\ReverseProxyMiddleware.php:47
7	0.0908	3973536	Drupal\page_cache\StackMiddleware\PageCache->pass( )	...\PageCache.php:78
8	0.0908	3973536	Drupal\Core\StackMiddleware\KernelPreHandle->handle( )	...\PageCache.php:99
9	0.2168	10821064	Drupal\Core\StackMiddleware\Session->handle( )	...\KernelPreHandle.php:47
10	0.2346	11186200	Symfony\Component\HttpKernel\HttpKernel->handle( )	...\Session.php:57
11	0.2346	11186616	Symfony\Component\HttpKernel\HttpKernel->handleRaw( )	...\HttpKernel.php:62
12	0.5732	17760320	call_user_func_array:{PATH/TO/SITE/vendor/symfony/http-kernel/HttpKernel.php:139} ( )	...\HttpKernel.php:139
13	0.5732	17760384	Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}( )	...\HttpKernel.php:139
14	0.5732	17760384	Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext( )	...\EarlyRenderingControllerWrapperSubscriber.php:97
15	0.5740	17833472	Drupal\Core\Render\Renderer->executeInRenderContext( )	...\EarlyRenderingControllerWrapperSubscriber.php:124
16	0.5741	17833864	Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}( )	...\Renderer.php:574
17	0.5741	17833864	call_user_func_array:{PATH/TO/SITE/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php:123} ( )	...\EarlyRenderingControllerWrapperSubscriber.php:123
18	0.5741	17834272	Drupal\Core\Controller\FormController->getContentResult( )	...\EarlyRenderingControllerWrapperSubscriber.php:123
19	0.5882	18296776	Drupal\Core\Form\FormBuilder->buildForm( )	...\FormController.php:74
20	3.8706	32802272	Drupal\Core\Form\FormBuilder->processForm( )	...\FormBuilder.php:314
21	4.0153	34610672	Drupal\Core\Form\FormSubmitter->doSubmitForm( )	...\FormBuilder.php:585
22	4.0153	34610672	Drupal\Core\Form\FormSubmitter->executeSubmitHandlers( )	...\FormSubmitter.php:51
23	4.0153	34611488	call_user_func_array:{PATH/TO/SITE/core/lib/Drupal/Core/Form/FormSubmitter.php:111} ( )	...\FormSubmitter.php:111
24	4.0153	34611520	Drupal\system\Form\ModulesListForm->submitForm( )	...\FormSubmitter.php:111
25	4.0171	34641664	Drupal\Core\ProxyClass\Extension\ModuleInstaller->install( )	...\ModulesListForm.php:450
26	4.0318	34899760	Drupal\Core\Extension\ModuleInstaller->install( )	...\ModuleInstaller.php:83
27	6.3510	46724848	Drupal\Component\DependencyInjection\Container->get( )	...\ModuleInstaller.php:200
28	6.3512	46843872	Drupal\Component\DependencyInjection\Container->createService( )	...\Container.php:177
29	6.3541	46898336	Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters( )	...\Container.php:329
30	6.3541	46898336	Drupal\Component\DependencyInjection\Container->get( )	...\Container.php:494
31	6.3541	46906016	Drupal\Component\DependencyInjection\Container->createService( )	...\Container.php:177
32	6.3654	43087928	Drupal\Core\Menu\LocalActionManager->__construct( )	...\Container.php:300
33	6.3655	43088120	Drupal\language\ConfigurableLanguageManager->getCurrentLanguage( )	...\LocalActionManager.php:133
34	6.3689	43112192	Drupal\language\LanguageNegotiator->initializeType( )	...\ConfigurableLanguageManager.php:218
35	6.3717	43148752	Drupal\language\LanguageNegotiator->negotiateLanguage( )	...\LanguageNegotiator.php:131
36	6.3718	43148848	Drupal\user\Plugin\LanguageNegotiation\LanguageNegotiationUser->getLangcode( )	...\LanguageNegotiator.php:186
37	6.3718	43148848	Drupal\Core\Session\AccountProxy->isAuthenticated( )	...\LanguageNegotiationUser.php:32
38	6.3718	43148848	Drupal\Core\Session\AccountProxy->getAccount( )	...\AccountProxy.php:89
39	6.3718	43148848	Drupal\Core\Session\AccountProxy->loadUserEntity( )	...\AccountProxy.php:54
40	6.3867	44410880	Drupal\Core\Entity\EntityStorageBase->load( )	...\AccountProxy.php:186
41	6.3867	44411256	Drupal\Core\Entity\EntityStorageBase->loadMultiple( )	...\EntityStorageBase.php:212
42	6.3868	44411688	Drupal\Core\Entity\Sql\SqlContentEntityStorage->doLoadMultiple( )	...\EntityStorageBase.php:242
43	6.3895	44411768	Drupal\Core\Entity\Sql\SqlContentEntityStorage->getFromStorage( )	...\SqlContentEntityStorage.php:399
44	6.5021	46859000	Drupal\Core\Entity\Sql\SqlContentEntityStorage->mapFromStorageRecords( )	...\SqlContentEntityStorage.php:433
45	6.5021	46861360	Drupal\Core\Entity\Sql\SqlContentEntityStorage->loadFromSharedTables( )	...\SqlContentEntityStorage.php:481
46	6.5049	46931472	_drupal_error_handler( )	...\SqlContentEntityStorage.php:568
47	6.5049	46931472	_drupal_error_handler_real( )	...\bootstrap.inc:548
48	6.5076	47091320	_drupal_log_error( )	...\errors.inc:84
49	6.5111	47294080	Drupal\Core\Logger\LoggerChannel->log( )	...\errors.inc:167
50	6.5113	47294888	Drupal\Core\Session\AccountProxy->id( )	...\LoggerChannel.php:119
51	6.5113	47294888	Drupal\Core\Session\AccountProxy->getAccount( )	...\AccountProxy.php:68
52	6.5113	47294888	Drupal\Core\Session\AccountProxy->loadUserEntity( )	...\AccountProxy.php:54
53	6.5113	47294888	Drupal\Core\Entity\EntityStorageBase->load( )	...\AccountProxy.php:186
54	6.5113	47295264	Drupal\Core\Entity\EntityStorageBase->loadMultiple( )	...\EntityStorageBase.php:212
55	6.5113	47295696	Drupal\Core\Entity\Sql\SqlContentEntityStorage->doLoadMultiple( )	...\EntityStorageBase.php:242
56	6.5118	47295776	Drupal\Core\Entity\Sql\SqlContentEntityStorage->getFromStorage( )	...\SqlContentEntityStorage.php:399
57	6.5125	47318016	Drupal\Core\Entity\Sql\SqlContentEntityStorage->mapFromStorageRecords( )	...\SqlContentEntityStorage.php:433
58	6.5126	47320376	Drupal\Core\Entity\Sql\SqlContentEntityStorage->loadFromSharedTables( )	...\SqlContentEntityStorage.php:481
Anonymous’s picture

It happens when

dataTable: users_field_data
revisionDataTable: null

and as result

$all_fields = $table_mapping->getFieldNames($this->dataTable);
Array
(
    [0] => uid
    [1] => langcode
    [2] => preferred_langcode
    [3] => preferred_admin_langcode
    [4] => name
    [5] => pass
    [6] => mail
    [7] => timezone
    [8] => status
    [9] => created
    [10] => changed
    [11] => access
    [12] => login
    [13] => init
    [14] => default_langcode
    [15] => ds_switch
)

but $row haven't ds_switch key:

Array
(
    [uid] => ..
    [langcode] => ..
    [preferred_langcode] => ..
    [name] => ..
    [pass] => ..
    [mail] => ..
    [timezone] => ..
    [status] => ..
    [created] => ..
    [changed] => ..
    [access] => ..
    [login] => ..
    [init] => ..
    [default_langcode] => ..
)

Interesting fact that $row also haven't key 'preferred_admin_langcode', but this does not cause problems.

This patch solves the problem 'Undefined index: ds_switch' via set custom storage, but I'm not sure of its suitability. Also helpful filter by type 'node', like patch from #2770171: DatabaseExceptionWrapper: SQLSTATE[42S22], or maybe like code:

if ($entity_type->id() === 'node') {
 // code here
}
Anonymous’s picture

lizperalta’s picture

This post has been very helpful, because I am getting the 500 Internal server error and it started happening after installing the ds display module. I have been trying to troubleshoot the problem and came across this. The error log indicates that the problem is with ds switch portion. I want to try this patch, but I am not understanding how to install it on the server running drupal. Any help would be great!

aspilicious’s picture

aspilicious’s picture

Status: Needs review » Closed (duplicate)