I noticed that in some cases, the method \Drupal\siteimprove\SiteimproveUtils::getEntityUrls does not return an array. Where this method is used (\Drupal\siteimprove\SiteimproveUtils::setSessionUrl), however, an array is always expected.

I'll add a small patch to fix the return of the getEntityUrls method.

CommentFileSizeAuthor
#2 3128478-2.patch699 bytesSpadXIII
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

SpadXIII created an issue. See original summary.

SpadXIII’s picture

Status: Active » Needs review
FileSize
699 bytes
alberto56’s picture

Status: Needs review » Reviewed & tested by the community

Works well, thanks. This patch does away with this error:

Warning: Invalid argument supplied for foreach() in Drupal\siteimprove\SiteimproveUtils->setSessionUrl() (line 154 of modules/contrib/siteimprove/src/SiteimproveUtils.php).
Drupal\siteimprove\SiteimproveUtils->setSessionUrl(Object) (Line: 65)
_siteimprove_entity_save(Object) (Line: 54)
siteimprove_entity_update(Object)
call_user_func_array('siteimprove_entity_update', Array) (Line: 403)
Drupal\Core\Extension\ModuleHandler->invokeAll('entity_update', Array) (Line: 206)
Drupal\Core\Entity\EntityStorageBase->invokeHook('update', Object) (Line: 843)
Drupal\Core\Entity\ContentEntityStorageBase->invokeHook('update', Object) (Line: 535)
Drupal\Core\Entity\EntityStorageBase->doPostSave(Object, 1) (Line: 728)
Drupal\Core\Entity\ContentEntityStorageBase->doPostSave(Object, 1) (Line: 460)
Drupal\Core\Entity\EntityStorageBase->save(Object) (Line: 837)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->save(Object) (Line: 395)
Drupal\Core\Entity\EntityBase->save() (Line: 294)
Drupal\node\NodeForm->save(Array, Object)
call_user_func_array(Array, Array) (Line: 114)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 52)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 591)
Drupal\Core\Form\FormBuilder->processForm('node_doctor_edit_form', Array, Object) (Line: 320)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 91)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 573)
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}() (Line: 151)
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: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 50)
Drupal\ban\BanMiddleware->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 708)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
esod’s picture

I confirm this patch is working. With the 8x-1.5 update we are seeing this error

Warning: Invalid argument supplied for foreach() in Drupal\siteimprove\SiteimproveUtils->setSessionUrl() (line 154 of /var/www/builds/mskcc_deploy-develop/web/modules/contrib/siteimprove/src/SiteimproveUtils.php)

on every node save, so it's important to apply this patch before going live.

beltofte’s picture

Assigned: Unassigned » beltofte

  • beltofte committed f533289 on 8.x-1.x authored by SpadXIII
    Issue #3128478 by SpadXIII, alberto56, esod, beltofte: SiteimproveUtils...
beltofte’s picture

Fixed. Thanks guys!

beltofte’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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