Problem/Motivation
Error: Cannot use string offset as an array en claro_form_system_modules_alter() (línea 754 de /var/www/html/web/core/themes/claro/claro.theme)
#0 /var/www/html/web/core/lib/Drupal/Core/Theme/ThemeManager.php(449): claro_form_system_modules_alter(Array, Object(Drupal\Core\Form\FormState), 'system_modules')
#1 /var/www/html/web/core/lib/Drupal/Core/Theme/ThemeManager.php(458): Drupal\Core\Theme\ThemeManager->alterForTheme(Object(Drupal\Core\Theme\ActiveTheme), 'form', Array, Object(Drupal\Core\Form\FormState), 'system_modules')
#2 /var/www/html/web/core/lib/Drupal/Core/Form/FormBuilder.php(837): Drupal\Core\Theme\ThemeManager->alter(Array, Array, Object(Drupal\Core\Form\FormState), 'system_modules')
#3 /var/www/html/web/core/lib/Drupal/Core/Form/FormBuilder.php(279): Drupal\Core\Form\FormBuilder->prepareForm('system_modules', Array, Object(Drupal\Core\Form\FormState))
#4 /var/www/html/web/core/lib/Drupal/Core/Controller/FormController.php(73): Drupal\Core\Form\FormBuilder->buildForm(Object(Drupal\system\Form\ModulesListForm), Object(Drupal\Core\Form\FormState))
#5 [internal function]: Drupal\Core\Controller\FormController->getContentResult(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\RouteMatch))
#6 /var/www/html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#7 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(573): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
Steps to reproduce
- Install module Themable forms (themable_forms)
- Install theme claro
- Go to https://example.site/admin/modules
Proposed resolution
Add an array_key_exist check before using this key
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | After Patch 3203745.png | 292.75 KB | chetanbharambe |
| #9 | Before Patch 3203745 One.png | 101.15 KB | chetanbharambe |
| #4 | 3203745-after_1.png | 61.57 KB | abhijith s |
| #4 | 3203745-before_2.png | 12.29 KB | abhijith s |
| #4 | 3203745-before_1.png | 174 KB | abhijith s |
Issue fork drupal-3203745
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
darienmh commentedComment #3
cilefen commentedI don't think that this meets the definition of a critical bug—for example, Claro is experimental—so I am moving it to major.
Comment #4
abhijith s commentedApplied patch #2 on 9.2.x and it works fine.
Before patch:

After patch:

Comment #5
seppe beelprez commentedHad the same issue, think it's a duplicate of this one: https://www.drupal.org/project/drupal/issues/3204052#comment-14032889
Comment #7
edmund.dunn commentedThis worked for me.
Comment #8
gorkagr commentedCommit in #6 works for me as well in 9.2.7, with the themable_forms module installed
thnks
Comment #9
chetanbharambe commentedVerified and tested Merge Request !448 (https://git.drupalcode.org/project/drupal/-/merge_requests/448.patch)
Merge Request applied successfully and looks good to me.
Testing Steps:
# Goto: Appearance -> Apply Claro theme
# Goto: Extend -> Install New Module -> Themable Forms
# Try to install it
# Check the results
Expected Results:
# User should be able to install the Themable forms module
Actual Results:
# Currently, the User is able to see errors.
Please refer attached screenshots for the same.
Looks good to me.
Can be a move to RTBC.
Comment #10
alexpottDiscussed with @lauriii we decided to commit this as an extra safety level around claro's form alter. That said we both agreed that this probably points to issues with the Themable Forms module as it might be making changes that would prove to be incompatible with other themes as well.
Also given Claro is experimental and https://www.drupal.org/project/themable_forms only has a beta release this is not a major bug.
Committed and pushed 2a03fb2c53 to 9.3.x and 5bc445ba77 to 9.2.x. Thanks!
Backported to 9.2.x as this is a low risk bug fix.