I'm running on Drupal 9.5.9
PHP v8.1.26
Single Content Sync v1.4.10
When upgraded I faced the hook update issues too.
I had to disable and enable the module to work.
When accessing any entity page (or view rendering entities) I get the following error.
The website encountered an unexpected error. Please try again later.
TypeError: in_array(): Argument #2 ($haystack) must be of type array, string given in in_array() (line 236 of modules/contrib/single_content_sync/src/ContentSyncHelper.php).
in_array('MY-ENTITY-BUNDLE', 'MY-ENTITY-TYPE', 1) (Line: 236)
Drupal\single_content_sync\ContentSyncHelper->access(Object) (Line: 85)
single_content_sync_entity_operation(Object)
call_user_func_array(Object, Array) (Line: 426)
Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}(Object, 'single_content_sync') (Line: 405)
Drupal\Core\Extension\ModuleHandler->invokeAllWith('entity_operation', Object) (Line: 433)
Drupal\Core\Extension\ModuleHandler->invokeAll('entity_operation', Array) (Line: 113)
Drupal\Core\Entity\EntityListBuilder->getOperations(Object) (Line: 411)
Drupal\taxonomy\Form\OverviewTerms->buildForm(Array, Object, Object)
call_user_func_array(Array, Array) (Line: 536)
Drupal\Core\Form\FormBuilder->retrieveForm('taxonomy_overview_terms', Object) (Line: 283)
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: 580)
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: 169)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 81)
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: 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: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 718)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
After debugging the code at that line ($allowed_entity_types[$entity_type_id] === [] || in_array($entity->bundle(), $allowed_entity_types[$entity_type_id], TRUE)) &&
the $entity->bundle()
variable contains my bundle and the $allowed_entity_types[$entity_type_id]
contains the entity type id as a string, not an array as the in_array() function expects on the second argument.
By removing the element from the array on the $allowed_entity_types[$entity_type_id]
variable to $allowed_entity_types
the site worked again.