Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I have created a new Text Format 'Simple Plain' and selected 'Ckeditor' and then save the format. Then in a node, I have used this text format and added some contents.
-Then after I edit Text Format 'Simple Plain' (/admin/config/content/formats/manage/simple_plain) and selected 'none' in Text editor (see image2.jpg), I got below mentioned error on save configuration .
TypeError: Argument 1 passed to Drupal\Core\Form\SubformState::createForSubform() must be of the type array, null given, called in /code/core/modules/editor/editor.module on line 251 in Drupal\Core\Form\SubformState::createForSubform() (line 56 of /code/core/lib/Drupal/Core/Form/SubformState.php)
#0 /code/core/modules/editor/editor.module(251): Drupal\Core\Form\SubformState::createForSubform(NULL, Array, Object(Drupal\Core\Form\FormState))
#1 [internal function]: editor_form_filter_admin_format_submit(Array, Object(Drupal\Core\Form\FormState))
#2 /code/core/lib/Drupal/Core/Form/FormSubmitter.php(114): call_user_func_array('editor_form_fil...', Array)
#3 /code/core/lib/Drupal/Core/Form/FormSubmitter.php(52): Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object(Drupal\Core\Form\FormState))
#4 /code/core/lib/Drupal/Core/Form/FormBuilder.php(591): Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object(Drupal\Core\Form\FormState))
#5 /code/core/lib/Drupal/Core/Form/FormBuilder.php(320): Drupal\Core\Form\FormBuilder->processForm('filter_format_e...', Array, Object(Drupal\Core\Form\FormState))
#6 /code/core/lib/Drupal/Core/Controller/FormController.php(91): Drupal\Core\Form\FormBuilder->buildForm(Object(Drupal\filter\FilterFormatEditForm), Object(Drupal\Core\Form\FormState))
#7 [internal function]: Drupal\Core\Controller\FormController->getContentResult(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\RouteMatch))
#8 /code/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#9 /code/core/lib/Drupal/Core/Render/Renderer.php(573): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#10 /code/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#11 /code/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
#12 /code/vendor/symfony/http-kernel/HttpKernel.php(151): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#13 /code/vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#14 /code/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#15 /code/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#16 /code/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#17 /code/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#18 /code/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#19 /code/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#20 /code/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#21 /code/core/lib/Drupal/Core/DrupalKernel.php(694): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#22 /code/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#23 {main}
Comment | File | Size | Author |
---|---|---|---|
#25 | argument_one_must_be_an_array-3136406-d89-25.patch | 1.88 KB | Spokje |
#22 | test_only_should_fail.patch | 997 bytes | Spokje |
#22 | interdiff_18_22.txt | 851 bytes | Spokje |
#22 | argument_one_must_be_an_array-3136406-22.patch | 1.88 KB | Spokje |
#18 | argument_one_must_be_an_array-3136406-18.patch | 1.62 KB | IJsbrandy |
Comments
Comment #2
codersukanta CreditAttribution: codersukanta at Srijan | A Material+ Company for Drupal India Association commentedReproduced the issue in my local, We don't need to add any content with the new text format to reproduce the issue.
Just add a new Text Format 'Simple Plain' with the 'Ckeditor' selected. Then edit the Text Format with "None" selected.
Assigning to me to start working on it.
Comment #3
codersukanta CreditAttribution: codersukanta at Srijan | A Material+ Company for Drupal India Association commentedPatch added
Comment #4
dishabhadra CreditAttribution: dishabhadra at Axelerant commentedI am also able to reproduce this issue.
I tested your patch, it looks good to me.
+1 for RTBC.
Comment #5
atul4drupal CreditAttribution: atul4drupal commentedHello codersukanta,
Thanks for working on this, the fix has come really fast.
Comment #6
xjmThanks for filing this bug report and for fixing the issue.
In order to commit a bug fix, we need an automated to test to prove that we've fixed the bug and ensure that we don't break it again in the future. For more information about writing tests in Drupal 8 see the following links:
Comment #7
atul4drupal CreditAttribution: atul4drupal commentedHello xjm,
Thanks for the guidance and the resources shared....
I checked the piece of code that #3 has worked upon, it has a test coverage already mentioned in "core/modules/editor/tests/src/Functional/EditorAdminTest.php" file at function testAddEditorToNewFormat()
How can we have that triggered on the patch at #3, or how D.O test runner checks for the existing test cases to be executed. This will help us better understand the test bot.
Thanks.
Comment #8
atul4drupal CreditAttribution: atul4drupal at Srijan | A Material+ Company commenteddidn't noticed status changing to 'Neede Review' reverting as per #6
Comment #9
atul4drupal CreditAttribution: atul4drupal at Srijan | A Material+ Company commentedI see this been executed by test bot and bot seems happy with the patch at #3
I think this might meet the test requirement as suggested in #6, kindly correct if I get this otherwise.
Updateing for needs review.
Comment #10
atul4drupal CreditAttribution: atul4drupal at Srijan | A Material+ Company commentedComment #11
BalajiDS CreditAttribution: BalajiDS at UniMity Solutions Pvt Limited for Drupal India Association commentedPatch #3 is working fine in Drupal-8.8.6 and there are no logs were found in /admin/reports/dblog
Comment #12
Sivaji_Ganesh_Jojodae CreditAttribution: Sivaji_Ganesh_Jojodae as a volunteer and commented$editor_plugin = $form_state...
, is that meant to be an assignment=
or comparison==
?Comment #13
codersukanta CreditAttribution: codersukanta at Srijan | A Material+ Company for Drupal India Association commentedHi @Devjojodae,
$editor_plugin = $form_state->get('editor_plugin')
This is an assignment statement(=) as $editor_plugin is used to call the submitConfigurationForm function.
Comment #15
peterx CreditAttribution: peterx as a volunteer commentedI just had the same error in 9.0.3. Tried to switch off CKEditor in the settings. No error switching CKEditor on. I guess the code is the similar.
In 9.0.3, the change is at line 250 but #3 does not fix it. The code must be a bit different.
Comment #16
ericdsd CreditAttribution: ericdsd commentedPatch #3 works like a charm with 8.9.6
Comment #17
catchThis is a fatal error reproducible purely by configuration in the UI, so bumping to critical.
@atul4drupal
We need to add test coverage to show that this patch fixes the bug - at the moment the test coverage only shows that it doesn't make things worse.
So
Functional/EditorAdminTest.php
should be expanded to check the case where the editor selection is changed to none - and that test should fail without the patch applied.Comment #18
IJsbrandy CreditAttribution: IJsbrandy at Betawerk commentedPatch #3 works.
I can reproduce this fatal error by saving the editor configuration under the testAddEditorToExistingFormat() test without the patch.
Patch added with minor adjustment to the tests. Should we make separate test for this issue or should this minor change to the tests be sufficient enough?
Comment #19
heddnI an confirm the steps to reproduce in the IS are accurate.
Comment #20
thomaswalther CreditAttribution: thomaswalther commentedI changed the form settings for "/admin/config/content/formats/manage/full_html".
In the dropdown "form-item-editor-editor" I select "none" (not CKeditor)
Error:
Comment #21
SpokjeI can confirm the following steps produce the same error on the latest 9.2.x-dev branch:
- Go to
/admin/config/content/formats/manage/full_html
- Change the drop-down Text editor from
CKEditor
toNone
- Press button
Save configuration
- CLUNK
TypeError: Argument 1 passed to Drupal\Core\Form\SubformState::createForSubform() must be of the type array, null given, called in D:\htdocs\drupal\core\modules\editor\editor.module on line 251 in Drupal\Core\Form\SubformState::createForSubform() (line 56 of D:\htdocs\drupal\core\lib\Drupal\Core\Form\SubformState.php)
Bumping version to 9.2.x-dev (looks like this is going to be a backport-party when we got a working patch...)
Assigning to myself to create a test that fails without the patch and passes when it's applied
Comment #22
SpokjeLet's see what TestBot has to say about these patches.
Comment #23
SpokjeOk, so now we have a failing test without the patch and the same test passes with the patch, so Needs Review seems in order.
Also:
We have confirmation that this bug also appears in 9.0.x and 8.9.x.
Basically that means it also appears in 9.1.x
I think this patch will smoothly apply to 9.1 and 9.0, for 8.9 we probably have to change the
$this->submitForm
to the 8.x equivalent$this->drupalPostForm
Comment #24
heddnI like it.
Comment #25
SpokjeAs expected
argument_one_must_be_an_array-3136406-22.patch
applies cleanly on 9.0.x, 9.1.x and 9.2.x.Looks like 8.9.x just has a few lines offset, but no code changes are needed.
Let's see if that theory is correct with the attached patch.
Comment #26
SpokjeTLDR;
9.2.x
,9.1.x
,9.0.x
: argument_one_must_be_an_array-3136406-22.patch8.9.x
: argument_one_must_be_an_array-3136406-d89-25.patchComment #27
quietone CreditAttribution: quietone as a volunteer commentedRemoving needs tests tag because there is test.
Comment #30
larowlanI manually tested this locally before and after the patch and confirmed both the bug and that this fixes it.
We also have test coverage for the bug.
I also verified that we could switch back to an editor, and this worked too.
As this is a bug fix, non disruptive and critical - backported to 9.1.x
Leaving at 9.0.x for possible backport there too.
Comment #31
alexpottI think this should go in 8.9.x as well as 9.0.x too
Comment #34
larowlanBackported to 9.0.x and 8.9.x
Thanks all