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.
Getting following PHP warning:
Warning: array_unshift() expects parameter 1 to be array, null given in xmlsitemap_add_form_link_options() (line 1220 of modules/contrib/xmlsitemap/xmlsitemap.module).
xmlsitemap_add_form_link_options(Array, 'node', 'block_page', NULL) (Line: 1527)
xmlsitemap_form_alter(Array, Object, 'node_block_page_form') (Line: 501)
Drupal\Core\Extension\ModuleHandler->alter('form', Array, Object, 'node_block_page_form') (Line: 830)
Drupal\Core\Form\FormBuilder->prepareForm('node_block_page_form', Array, Object) (Line: 272)
Drupal\Core\Form\FormBuilder->buildForm('node_block_page_form', Object) (Line: 48)
Drupal\Core\Entity\EntityFormBuilder->getForm(Object) (Line: 113)
Drupal\node\Controller\NodeController->add(Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 576)
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}()
call_user_func_array(Object, Array) (Line: 153)
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: 99)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 57)
Drupal\shield\ShieldMiddleware->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 657)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Only happens if the content type doesn't have any field except title.
Happens because of none of the modules adding a submit handler for publish action. The code should handle these scenario and gracefully handle it.
Comment | File | Size | Author |
---|---|---|---|
#2 | null_param_to_array_unshift-2921449-1.patch | 547 bytes | saikatewu@gmail.com |
Comments
Comment #2
saikatewu@gmail.com CreditAttribution: saikatewu@gmail.com as a volunteer commentedAttaching the patch that checks if the index has a value.
Comment #3
NitinSP CreditAttribution: NitinSP commentedThis looking fine, I am facing same error in my project and it is resolved after applying this patch.
Thanks.
Comment #4
renatogworks good.
Comment #6
renatogFixed.
Committed.
Thank you very much for contributions.
Best,