Fatal error when enabling CKEditor 5 syles. AssertionError: assert(NestedArray::keyExists($subform, $parts)) in assert()

Created on 16 January 2025, 6 days ago

Problem/Motivation

When I enable "Styles" in a CKEditor configuration I get a fatal error:

AssertionError: assert(NestedArray::keyExists($subform, $parts)) in assert() (line 886 of core/modules/ckeditor5/src/Plugin/Editor/CKEditor5.php).
Drupal\ckeditor5\Plugin\Editor\CKEditor5::mapViolationPropertyPathsToFormNames('settings.plugins.ckeditor5_style.styles', Array) (Line: 922)
Drupal\ckeditor5\Plugin\Editor\CKEditor5::mapPairViolationPropertyPathsToFormNames('settings.plugins.ckeditor5_style.styles', Array) (Line: 707)
Drupal\ckeditor5\Plugin\Editor\CKEditor5->validateConfigurationForm(Array, Object) (Line: 207)
editor_form_filter_admin_format_validate(Array, Object)
call_user_func_array('editor_form_filter_admin_format_validate', Array) (Line: 82)
Drupal\Core\Form\FormValidator->executeValidateHandlers(Array, Object) (Line: 274)
Drupal\Core\Form\FormValidator->doValidateForm(Array, Object, 'filter_format_edit_form') (Line: 118)
Drupal\Core\Form\FormValidator->validateForm('filter_format_edit_form', Array, Object) (Line: 593)
Drupal\Core\Form\FormBuilder->processForm('filter_format_edit_form', Array, Object) (Line: 326)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
Drupal\Core\Controller\FormController->getContentResult(Object, Object) (Line: 39)
Drupal\layout_builder\Controller\LayoutBuilderHtmlEntityFormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 638)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 53)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 116)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 90)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 741)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
require('/Users/lluisandreu/Projects/drupal/miia-drupal/web/index.php') (Line: 48)

Steps to reproduce

Use "Basic HTML" text format with CKEditor 5.
Enable "Styles" dragging the button to the toolbar
Add any style, for example a.test|Test
Crash happens and I am unable to add styles.

🐛 Bug report
Status

Active

Version

10.5

Component

ckeditor5.module

Created by

🇪🇸Spain lluisandreu

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

Comments & Activities

  • Issue created by @lluisandreu
  • First commit to issue fork.
  • 🇳🇿New Zealand quietone

    Changes are made on on 11.x (our main development branch) first, and are then back ported as needed according to the Core change policies .

    I tested on a fresh install of 11.x HEAD, using the steps in the issue summary and did not get an error.

  • Information in comment #3 suggests there are additional steps to reproduce.

  • 🇮🇳India anjaliprasannan

    I have updated the drupal version now 11.x and with this the issue does not exist.

    Steps I followed as per the description:

    • In admin/config/content/formats click on configure of Basic HTML text format
    • Add Styles plugin to the active toolbar list
    • In the CKEditor 5 plugin settings add style format like a.test|Test for example
    • Save Configuration

    The configuration gets saved.

    The fatal error that appeared before is not shown.

    Screenshot

    Moving to RTBC.

  • 🇪🇸Spain lluisandreu

    I tried the same steps in another environment and it does work as expected, this error only happens to me in local. I will update the status to "closed".
    Thanks everybody for testing.

Production build 0.71.5 2024