Steps to reproduce
install drupal 10
PHP 8.2.12
TypeError: key(): Argument #1 ($array) must be of type array, null given in key() (line 424 of modules\contrib\entity_browser\src\Plugin\Field\FieldWidget\EntityReferenceBrowserWidget.php).
Drupal\entity_browser\Plugin\Field\FieldWidget\EntityReferenceBrowserWidget::processEntityBrowser(Array, Object, Array)
call_user_func_array(Array, Array) (Line: 1013)
Drupal\Core\Form\FormBuilder->doBuildForm('question_entity_text_question_add_form', Array, Object) (Line: 1076)
Drupal\Core\Form\FormBuilder->doBuildForm('question_entity_text_question_add_form', Array, Object) (Line: 1076)
Drupal\Core\Form\FormBuilder->doBuildForm('question_entity_text_question_add_form', Array, Object) (Line: 1076)
Drupal\Core\Form\FormBuilder->doBuildForm('question_entity_text_question_add_form', Array, Object) (Line: 579)
Drupal\Core\Form\FormBuilder->processForm('question_entity_text_question_add_form', Array, Object) (Line: 325)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 627)
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: 58)
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: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
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: 704)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | 2025-05-23-08.59.28-3440973.png | 221.33 KB | michaellenahan |
| #4 | entity_browser-3440973.patch | 1.08 KB | abhishek_gupta1 |
Issue fork entity_browser-3440973
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
abhishek_gupta1 commentedComment #3
jayprakash.kushwah commentedComment #4
abhishek_gupta1 commentedfixed the issue and created Patch.
Comment #5
jayprakash.kushwah commentedentity_browser-3440973.patch patch is working fine.
Comment #6
jayprakash.kushwah commentedComment #7
sharique commented+1 for RTBC.
Comment #8
berdirThis will just silently hide the notice, but the module won't properly work then I think, so needs clearer steps on how to reproduce.
Comment #9
danrodI got the same error on a fresh Drupal 11.1.4 install:
1. Added a new image field for the "Article" content type.
2. In the Form Display Manager, I set that field to use the "Entity Field" widget.
3. if I try to add an article (/node/add/article) I get the same error.
I'm using a ddev instance with PHP 8.2 installed.
Comment #10
bassline commentedI installed the entity_browser module in Drupal 10.4.5.
After switching to entity_browser in the content type form display management, I got the same error in the content edit screen.
After applying the #4 patch, I am now able to edit content on the content edit screen.
Comment #11
vipin.mittal18I faced the same issue, but applying the patch resolved it and unblocked me from creating content.
Comment #13
michaellenahan commentedI got this error, because no entity browser was selected for the field.
Make sure your entity browser instance is set up correctly:
admin/config/content/entity_browser
... then add the entity browser instance to your field
See screenshot:
https://www.drupal.org/files/issues/2025-05-23/2025-05-23-08.59.28-34409...
admin/structure/types/manage/page/form-display
No entity browser selected
Comment #15
neclimdulRan into this as well. Reviewing the merge request, the two if statements are just approximating an empty check so simplified it.
Here are the steps I used to recreate this.
1. Create a media field on a node or paragraph if you don't have one to test. It doesn't seem to matter where it exists.
2. On the "Manage form display" tab select "autocomplete" for the widget and save.
3. Now set it back to entity browser and save without expanding the gear and setting up the field.
Without the patch, at this point two things are broken throwing both an undefined array key warning and a fatal type error.
1. From the manage fields tab editing the field is broken.
2. The node form or paragraph addition form seem to also be broken.
With the patch everything is fine
1. Manage fields is normal. I don't see any use widget language so this call might not be strictly necessary.
2. The form "works" but the user is presented with "Entity browser not found. You can select one media item." which would prompt a developer to fix the form display.
Comment #16
jannakha commentedComment #17
anybodyConfirming RTBC and the steps in #15. Should be merged.
Comment #19
anybodyComment #20
anybodyComment #22
acbramley commentedThis was a duplicate of #2914385: Warning: key() expects parameter 1 to be array, null given in Drupal\entity_browser\Plugin\Field\FieldWidget\EntityReferenceBrowserWidget::processEntityBrowser() which was open since 2017.
Comment #23
dan_metille commentedOk, thanks. I guess that patch can now be removed from schemadotorg module.