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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

saikatewu created an issue. See original summary.

saikatewu@gmail.com’s picture

Attaching the patch that checks if the index has a value.

NitinSP’s picture

This looking fine, I am facing same error in my project and it is resolved after applying this patch.
Thanks.

renatog’s picture

Status: Needs review » Reviewed & tested by the community

works good.

  • RenatoG committed f638bc1 on 8.x-1.x authored by saikatewu
    Issue #2921449 by saikatewu, NitinSP, RenatoG: Warning: array_unshift()...
renatog’s picture

Status: Reviewed & tested by the community » Fixed

Fixed.

Committed.

Thank you very much for contributions.

Best,

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.