"Notice: Array to string conversion" when form element or field has a suffix and a Ajax callback

Created on 3 October 2019, almost 5 years ago
Updated 30 October 2023, 11 months ago

if a form element or a field (aka a Field UI field) has a suffix set, and in the form render array an Ajax callback is added, the following error will be displayed and the field suffix will contain the text "Array":

Notice: Array to string conversion in Drupal\bootstrap\Utility\Element->appendProperty() (line 173 of themes/contrib/bootstrap/src/Utility/Element.php).
Drupal\bootstrap\Utility\Element->appendProperty('field_suffix', Array) (Line: 95)
Drupal\bootstrap\Plugin\ProcessManager::processAjax(Object, Object, Array) (Line: 58)
Drupal\bootstrap\Plugin\ProcessManager::process(Array, Object, Array)
call_user_func_array(Array, Array) (Line: 998)
Drupal\Core\Form\FormBuilder->doBuildForm('bootstrap_form_test', Array, Object) (Line: 1061)
Drupal\Core\Form\FormBuilder->doBuildForm('bootstrap_form_test', Array, Object) (Line: 562)
Drupal\Core\Form\FormBuilder->processForm('bootstrap_form_test', Array, Object) (Line: 319)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 93)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 582)
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: 151)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
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: 693)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Steps to reproduce:

To help reproduce this issue a small custom module is attached in a Zip file, the module provides a route and a form which helps demonstrate the issues.

  1. Install Bootstrap theme.
  2. It's a good idea to turn on "All messages, with backtrace information" under Configuration > Logging and errors
  3. Download and enable the custom module attached to this issue in the Zip file bootstrap_form_test.zip β†’ .
  4. Once the module is enabled, navigate to the path /bootstrap_form_test
  5. On that page is a simple form with two text fields, you should see the same error message shown above, and the text "Array" printed in the suffix of the "Test" field.
πŸ› Bug report
Status

Closed: won't fix

Version

4.0

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom AaronMcHale Edinburgh, Scotland

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024