I'm using page manager 8.x-1.0-alpha24 with panels. This issue seems to crop up randomly, but when I attempt to edit variants on certain pages I receive the dreaded 'unexpected error' page. I even receive this error when attempting to delete the variant. Whenever I encounter it I end up having to resolve it by creating a new page in the page manager and apply the same settings but this isn't always an option. This is also currently running on the /node/{node} page, which I'm not sure I can delete. In the error log I receive this warning:
Message Warning: Invalid argument supplied for foreach() in Drupal\Component\Utility\NestedArray::mergeDeepArray() (line 327 of /var/www/mydev.dev/http/web/core/lib/Drupal/Component/Utility/NestedArray.php) #0 /var/www/mydev.dev/http/web/core/includes/bootstrap.inc(548): _drupal_error_handler_real(2, 'Invalid argumen...', '/var/www/aaep.o...', 327, Array) #1 /var/www/mydev.dev/http/web/core/lib/Drupal/Component/Utility/NestedArray.php(327): _drupal_error_handler(2, 'Invalid argumen...', '/var/www/aaep.o...', 327, Array) #2 /var/www/mydev.dev/http/web/core/lib/Drupal/Component/Utility/NestedArray.php(295): Drupal\Component\Utility\NestedArray::mergeDeepArray(Array) #3 /var/www/mydev.dev/http/web/core/lib/Drupal/Core/Block/BlockBase.php(76): Drupal\Component\Utility\NestedArray::mergeDeep(Array, NULL, Array) #4 /var/www/mydev.dev/http/web/core/lib/Drupal/Core/Plugin/DefaultLazyPluginCollection.php(162): Drupal\Core\Block\BlockBase->setConfiguration(Array) #5 /var/www/mydev.dev/http/web/core/lib/Drupal/Core/Plugin/DefaultLazyPluginCollection.php(135): Drupal\Core\Plugin\DefaultLazyPluginCollection->setInstanceConfiguration('16e9261f-a1ac-4...', Array) #6 /var/www/mydev.dev/http/web/modules/contrib/ctools/src/Plugin/DisplayVariant/BlockDisplayVariant.php(160): Drupal\Core\Plugin\DefaultLazyPluginCollection->setConfiguration(Array) #7 /var/www/mydev.dev/http/web/modules/contrib/panels/src/Plugin/DisplayVariant/PanelsDisplayVariant.php(471): Drupal\ctools\Plugin\DisplayVariant\BlockDisplayVariant->setConfiguration(Array) #8 /var/www/mydev.dev/http/web/core/lib/Drupal/Core/Display/VariantBase.php(30): Drupal\panels\Plugin\DisplayVariant\PanelsDisplayVariant->setConfiguration(Array) #9 /var/www/mydev.dev/http/web/modules/contrib/ctools/src/Plugin/DisplayVariant/BlockDisplayVariant.php(103): Drupal\Core\Display\VariantBase->__construct(Array, 'panels_variant', Array) #10 /var/www/mydev.dev/http/web/modules/contrib/panels/src/Plugin/DisplayVariant/PanelsDisplayVariant.php(106): Drupal\ctools\Plugin\DisplayVariant\BlockDisplayVariant->__construct(Array, 'panels_variant', Array, Object(Drupal\Core\Plugin\Context\ContextHandler), Object(Drupal\Core\Session\AccountProxy), Object(Drupal\Component\Uuid\Php), Object(Drupal\token\Token), Object(Drupal\Core\Block\BlockManager), Object(Drupal\Core\Condition\ConditionManager)) #11 /var/www/mydev.dev/http/web/modules/contrib/panels/src/Plugin/DisplayVariant/PanelsDisplayVariant.php(126): Drupal\panels\Plugin\DisplayVariant\PanelsDisplayVariant->__construct(Array, 'panels_variant', Array, Object(Drupal\Core\Plugin\Context\ContextHandler), Object(Drupal\Core\Session\AccountProxy), Object(Drupal\Component\Uuid\Php), Object(Drupal\token\Token), Object(Drupal\Core\Block\BlockManager), Object(Drupal\Core\Condition\ConditionManager), Object(Drupal\Core\Extension\ModuleHandler), Object(Drupal\panels\Plugin\DisplayBuilder\DisplayBuilderManager), Object(Drupal\layout_plugin\Plugin\Layout\LayoutPluginManager)) #12 /var/www/mydev.dev/http/web/core/lib/Drupal/Core/Plugin/Factory/ContainerFactory.php(21): Drupal\panels\Plugin\DisplayVariant\PanelsDisplayVariant::create(Object(Drupal\Core\DependencyInjection\Container), Array, 'panels_variant', Array) #13 /var/www/mydev.dev/http/web/core/lib/Drupal/Component/Plugin/PluginManagerBase.php(84): Drupal\Core\Plugin\Factory\ContainerFactory->createInstance('panels_variant', Array) #14 /var/www/mydev.dev/http/web/core/lib/Drupal/Core/Plugin/DefaultSingleLazyPluginCollection.php(65): Drupal\Component\Plugin\PluginManagerBase->createInstance('panels_variant', Array) #15 /var/www/mydev.dev/http/web/core/lib/Drupal/Component/Plugin/LazyPluginCollection.php(80): Drupal\Core\Plugin\DefaultSingleLazyPluginCollection->initializePlugin('panels_variant') #16 /var/www/mydev.dev/http/web/modules/contrib/page_manager/src/Entity/PageVariant.php(235): Drupal\Component\Plugin\LazyPluginCollection->get('panels_variant') #17 /var/www/mydev.dev/http/web/modules/contrib/page_manager/page_manager_ui/src/Wizard/PageEditWizard.php(94): Drupal\page_manager\Entity\PageVariant->getVariantPlugin() #18 /var/www/mydev.dev/http/web/modules/contrib/page_manager/page_manager_ui/src/Wizard/PageEditWizard.php(54): Drupal\page_manager_ui\Wizard\PageEditWizard->getVariantOperations(Object(Drupal\page_manager\Entity\PageVariant), Array) #19 /var/www/mydev.dev/http/web/modules/contrib/ctools/src/Wizard/FormWizardBase.php(165): Drupal\page_manager_ui\Wizard\PageEditWizard->getOperations(Array) #20 /var/www/mydev.dev/http/web/modules/contrib/ctools/src/Wizard/FormWizardBase.php(251): Drupal\ctools\Wizard\FormWizardBase->getOperation(Array) #21 [internal function]: Drupal\ctools\Wizard\FormWizardBase->buildForm(Array, Object(Drupal\Core\Form\FormState)) #22 /var/www/mydev.dev/http/web/core/lib/Drupal/Core/Form/FormBuilder.php(514): call_user_func_array(Array, Array) #23 /var/www/mydev.dev/http/web/core/lib/Drupal/Core/Form/FormBuilder.php(271): Drupal\Core\Form\FormBuilder->retrieveForm('page_manage_var...', Object(Drupal\Core\Form\FormState)) #24 /var/www/mydev.dev/http/web/modules/contrib/ctools/src/Wizard/WizardFactory.php(45): Drupal\Core\Form\FormBuilder->buildForm(Object(Drupal\page_manager_ui\Wizard\PageEditWizard), Object(Drupal\Core\Form\FormState)) #25 /var/www/mydev.dev/http/web/modules/contrib/ctools/src/Controller/WizardFormController.php(84): Drupal\ctools\Wizard\WizardFactory->getWizardForm(Object(Drupal\page_manager_ui\Wizard\PageEditWizard), Array, false) #26 [internal function]: Drupal\ctools\Controller\WizardFormController->getContentResult(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\RouteMatch)) #27 /var/www/mydev.dev/http/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array) #28 /var/www/mydev.dev/http/web/core/lib/Drupal/Core/Render/Renderer.php(574): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber{closure}() #29 /var/www/mydev.dev/http/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure)) #30 /var/www/mydev.dev/http/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) #31 [internal function]: Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber{closure}() #32 /var/www/mydev.dev/http/vendor/symfony/http-kernel/HttpKernel.php(144): call_user_func_array(Object(Closure), Array) #33 /var/www/mydev.dev/http/vendor/symfony/http-kernel/HttpKernel.php(64): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) #34 /var/www/mydev.dev/http/web/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #35 /var/www/mydev.dev/http/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #36 /var/www/mydev.dev/http/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(99): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #37 /var/www/mydev.dev/http/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(78): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true) #38 /var/www/mydev.dev/http/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #39 /var/www/mydev.dev/http/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(50): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #40 /var/www/mydev.dev/http/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #41 /var/www/mydev.dev/http/web/core/lib/Drupal/Core/DrupalKernel.php(652): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #42 /var/www/mydev.dev/http/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #43 {main}.
However I'm having trouble making sense of the error message. I make custom modules but I can't see any mention of them in the error message. So I'm having trouble making sense of it. At line 327 of NestedArray.php I do see that it needs an array and I'm assuming it didn't get that, but I'm not sure what else to do with that information. Is there a proper way to troubleshoot this? Or is this a known issue?
Even if there isn't a clear answer, is there a good method for troubleshooting issues for this yet?
UPDATE: I was able to temporarily get it to work by applying this patch https://www.drupal.org/node/2831521 to ctools. And returning to the latest version of page_manager But after some time it broke once again. And gave me the error I was getting in the very beginning.
UPDATE 2: I turned on logging with backtrace information and got a better error message
The website encountered an unexpected error. Please try again later. Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: INSERT INTO {watchdog} (uid, type, message, variables, severity, link, location, referer, hostname, timestamp) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9); Array ( [:db_insert_placeholder_0] => 54 [:db_insert_placeholder_1] => php [:db_insert_placeholder_2] => %type: @message in %function (line %line of %file). [:db_insert_placeholder_3] => a:6:{s:5:"%type";s:45:"Drupal\Core\Database\DatabaseExceptionWrapper";s:8:"@message";s:4810210:"SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: UPDATE {key_value_expire} SET value=:db_update_placeholder_0, expire=:db_update_placeholder_1 WHERE ( (name = :db_condition_placeholder_0) AND (collection = :db_condition_placeholder_1) ); Array ( [:db_update_placeholder_0] => O:8:"stdClass":3:{s:5:"owner";s:2:"54";s:4:"data";a:6:{s:4:"page";O:31:"Drupal\page_manager\Entity\Page":24:{s:5:"*id";s:9:"node_view";s:8:"*label";s:9:"Node view";s:14:"*description";s:0:"";s:7:"*path";s:12:"/node/{node}";s:11:"*variants";a:15:{s:26:"node_view-panels_variant-3";O:38:"Drupal\page_manager\Entity\PageVariant":27:{s:5:"*id";s:26:"node_view-panels_variant-3";s:8:"*label";s:9:"Get A DVM";s:9:"*weight";i:0;s:7:"*uuid";s:36:"ace4efd4-dadc-43a9-afbb-6703c4b4cc9c";s:10:"*variant";s:14:"panels_variant";s:19:"*variant_settings";a:11:{s:6:"blocks";a:5:{s:36:"c88ac011-7207-4268-a4f8-548eebadd7bc";a:9:{s:2:"id";s:7:"getadvm";s:5:"label";s:9:"Get a DVM";s:8:"provider";s:12
And then a huge list of values of the settings in each block plugin. Huge as in a 5MB text file of errors. I checked the max post size though and it was 200MB.
My guess is that the SQL query is just too gigantic? Either way it's submitting the info of every single variant instead of just one.
$element = parent::settingsForm($form, $form_state);
being set, and then afterwards being set to['#access'] = FALSE;
Maybe you do something similar in your custom plugin?