Problem/Motivation

I was messing around with Drupal 9 to optimize our configuration management workflow when I stumbled upon this module, so I wanted to give it a try. I tried it out on a local setup with the Umami profile.

Visiting /admin/config/development/configuration/full/update gives me this error though :

The website encountered an unexpected error. Please try again later.
Error: Unsupported operand types in Drupal\Core\Render\Element\Select::processSelect() (line 152 of core/lib/Drupal/Core/Render/Element/Select.php).

Drupal\Core\Render\Element\Select::processSelect(Array, Object, Array)
call_user_func_array(Array, Array) (Line: 1008)
Drupal\Core\Form\FormBuilder->doBuildForm('config_update_form', Array, Object) (Line: 1071)
Drupal\Core\Form\FormBuilder->doBuildForm('config_update_form', Array, Object) (Line: 575)
Drupal\Core\Form\FormBuilder->processForm('config_update_form', Array, Object) (Line: 321)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 573)
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}() (Line: 158)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 80)
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: 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: 706)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Steps to reproduce

A clean Drupal 9 install with drupal/recommended-project, and a drush install of the Umami profile. The module was added with composer and enabled with Drush. When you visit the configuration page of the module, you get this error.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Comments

codemann created an issue. See original summary.

codemann’s picture

Title: Error when instlaling on Drupal 9 » Error when installing on Drupal 9
dunebl’s picture

Priority: Normal » Major

Same error on Drupal 9.1.2.
I set it as Major because the module is simply unusable on D9

dunebl’s picture

Looks like it is the #option in the below code which is not working:
modules/contrib/config_direct_save/src/Form/UpdateConfigurationForm.php

  public function buildForm(array $form, FormStateInterface $form_state) {
    $form['config_directory'] = [
      '#type' => 'select',
      '#required' => TRUE,
      '#title' => $this->t('Config source'),
      '#description' => $this->t('Select config source directory'),
      '#options' => array_flip($GLOBALS['config_directories']),
    ];

I am not sure, but maybe this should be replaced by:
'#options' => [Settings::get('config_sync_directory')],
With an added use clause at the top of the file:

use Drupal\Core\Site\Settings;
saitanay’s picture

Stumbled into the same issue. #4 works.

mimran’s picture

Applied #4 and endup with following error when tryto update configurations

Warning: file_put_contents(0/views.view.who_s_online.yml): failed to open stream: No such file or directory in Drupal\config_direct_save\Form\UpdateConfigurationForm->createConfigFiles() (line 138 of /app/web/modules/composer/config_direct_save/src/Form/UpdateConfigurationForm.php)
#0 /app/web/core/includes/bootstrap.inc(305): _drupal_error_handler_real(2, 'file_put_conten...', '/app/web/module...', 138)
#1 [internal function]: _drupal_error_handler(2, 'file_put_conten...', '/app/web/module...', 138, Array)
#2 /app/web/modules/composer/config_direct_save/src/Form/UpdateConfigurationForm.php(138): file_put_contents('0/views.view.wh...', 'uuid: 24207d90-...')
#3 /app/web/modules/composer/config_direct_save/src/Form/UpdateConfigurationForm.php(113): Drupal\config_direct_save\Form\UpdateConfigurationForm->createConfigFiles(Array, Object(Drupal\Core\Form\FormState))
#4 [internal function]: Drupal\config_direct_save\Form\UpdateConfigurationForm->submitForm(Array, Object(Drupal\Core\Form\FormState))
#5 /app/web/core/lib/Drupal/Core/Form/FormSubmitter.php(113): call_user_func_array(Array, Array)
#6 /app/web/core/lib/Drupal/Core/Form/FormSubmitter.php(51): Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object(Drupal\Core\Form\FormState))
#7 /app/web/core/lib/Drupal/Core/Form/FormBuilder.php(593): Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object(Drupal\Core\Form\FormState))
#8 /app/web/core/lib/Drupal/Core/Form/FormBuilder.php(321): Drupal\Core\Form\FormBuilder->processForm('config_update_f...', Array, Object(Drupal\Core\Form\FormState))
#9 /app/web/core/lib/Drupal/Core/Controller/FormController.php(73): Drupal\Core\Form\FormBuilder->buildForm(Object(Drupal\config_direct_save\Form\UpdateConfigurationForm), Object(Drupal\Core\Form\FormState))
#10 [internal function]: Drupal\Core\Controller\FormController->getContentResult(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\RouteMatch))
#11 /app/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#12 /app/web/core/lib/Drupal/Core/Render/Renderer.php(573): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
guilhermevp’s picture

StatusFileSize
new172.89 KB
new60.35 KB

Was able to reproduce the error and patch#4 works as intended.

guilhermevp’s picture

Status: Active » Reviewed & tested by the community

Ops.

mimran’s picture

Status: Reviewed & tested by the community » Needs work
mimran’s picture

mimran’s picture

Status: Needs work » Needs review

  • matio89 committed 7048814 on 8.x-1.x authored by mimran
    Issue #3192518 by mimran, saitanay, guilhermevp: Error when installing...
matio89’s picture

Version: 8.x-1.2 » 8.x-1.x-dev
Status: Needs review » Fixed

Hi!
The last patch is working fine with D8/D9 versions.

Thanks!

matio89’s picture

Status: Fixed » Closed (fixed)