PHP errors when saving settings form

Created on 26 July 2023, over 1 year ago
Updated 22 February 2024, about 1 year ago

Problem/Motivation

I got these errors when trying to save the settings form.

Warning: foreach() argument must be of type array|object, null given in Drupal\Core\Render\Element\Checkboxes::valueCallback() (line 113 of .../web/core/lib/Drupal/Core/Render/Element/Checkboxes.php)
#0 /var/www/u-staging/web/core/includes/bootstrap.inc(347): _drupal_error_handler_real()
#1 /var/www/u-staging/web/core/lib/Drupal/Core/Render/Element/Checkboxes.php(113): _drupal_error_handler()
#2 [internal function]: Drupal\Core\Render\Element\Checkboxes::valueCallback()
#3 /var/www/u-staging/web/core/lib/Drupal/Core/Form/FormBuilder.php(1299): call_user_func_array()
#4 /var/www/u-staging/web/core/lib/Drupal/Core/Form/FormBuilder.php(1017): Drupal\Core\Form\FormBuilder->handleInputElement()
#5 /var/www/u-staging/web/core/lib/Drupal/Core/Form/FormBuilder.php(1087): Drupal\Core\Form\FormBuilder->doBuildForm()
#6 /var/www/u-staging/web/core/lib/Drupal/Core/Form/FormBuilder.php(1087): Drupal\Core\Form\FormBuilder->doBuildForm()
#7 /var/www/u-staging/web/core/lib/Drupal/Core/Form/FormBuilder.php(579): Drupal\Core\Form\FormBuilder->doBuildForm()
#8 /var/www/u-staging/web/core/lib/Drupal/Core/Form/FormBuilder.php(325): Drupal\Core\Form\FormBuilder->processForm()
#9 /var/www/u-staging/web/core/lib/Drupal/Core/Controller/FormController.php(73): Drupal\Core\Form\FormBuilder->buildForm()
#10 [internal function]: Drupal\Core\Controller\FormController->getContentResult()
...

ValueError: array_chunk(): Argument #2 ($length) must be greater than 0 in array_chunk() (line 121 of /var/www/u-staging/web/modules/contrib/linkchecker/src/LinkCheckerService.php)
#0 /var/www/u-staging/web/modules/contrib/linkchecker/src/LinkCheckerService.php(121): array_chunk()
#1 /var/www/u-staging/web/modules/contrib/linkchecker/src/Form/LinkCheckerAdminSettingsForm.php(607): Drupal\linkchecker\LinkCheckerService->queueLinks()
#2 [internal function]: Drupal\linkchecker\Form\LinkCheckerAdminSettingsForm->submitForm()
#3 /var/www/u-staging/web/core/lib/Drupal/Core/Form/FormSubmitter.php(114): call_user_func_array()
#4 /var/www/u-staging/web/core/lib/Drupal/Core/Form/FormSubmitter.php(52): Drupal\Core\Form\FormSubmitter->executeSubmitHandlers()
#5 /var/www/u-staging/web/core/lib/Drupal/Core/Form/FormBuilder.php(609): Drupal\Core\Form\FormSubmitter->doSubmitForm()
#6 /var/www/u-staging/web/core/lib/Drupal/Core/Form/FormBuilder.php(325): Drupal\Core\Form\FormBuilder->processForm()
#7 /var/www/u-staging/web/core/lib/Drupal/Core/Controller/FormController.php(73): Drupal\Core\Form\FormBuilder->buildForm()
#8 [internal function]: Drupal\Core\Controller\FormController->getContentResult()

Steps to reproduce

  1. Delete the linkchecker.settings.yml config file
  2. Import config with drush cim -y
  3. I then set a bunch of settings and tried to save the form. Specifically, I was trying to get the settings back that I had prior to deleting the config file. My config file is attached.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Needs review

Version

2.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024