Because of

$this->accessStorage->getUserTermPermissionsByTids($tids);

returns an not empty array ([0 => NULL]) the empty check at

    if (!empty($rids)) {
      $roles = Role::loadMultiple($rids);
    }

is allways true, but NULL is not a flipable Value. I fixed it.

Warning: array_flip(): Can only flip STRING and INTEGER values! in Drupal\Core\Entity\EntityStorageBase->loadMultiple() (line 227 of core/lib/Drupal/Core/Entity/EntityStorageBase.php).
Drupal\Core\Entity\EntityStorageBase->loadMultiple(Array) (Line: 507)
Drupal\Core\Entity\Entity::loadMultiple(Array) (Line: 67)
Drupal\permissions_by_term\Service\Info->renderNodeDetails('60', 'modules/permissions_by_term/src/View/node-details.html.twig') (Line: 221)
permissions_by_term_form_alter(Array, Object, 'node_page_edit_form') (Line: 501)
Drupal\Core\Extension\ModuleHandler->alter('form', Array, Object, 'node_page_edit_form') (Line: 819)
Drupal\Core\Form\FormBuilder->prepareForm('node_page_edit_form', Array, Object) (Line: 272)
Drupal\Core\Form\FormBuilder->buildForm('node_page_edit_form', Object) (Line: 74)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 574)
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: 144)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 64)
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: 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: 656)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Comments

JR Tera3yte created an issue. See original summary.

jepster_’s picture

Status: Patch (to be ported) » Postponed (maintainer needs more info)

Thanks for reporting. Have you forgotten to upload the patch?

JR Tera3yte’s picture

StatusFileSize
new863 bytes

Sorry, I was not able to upload it earlier because I was not confirmed.

JR Tera3yte’s picture

StatusFileSize
new864 bytes

Changed public function to a private function

JR Tera3yte’s picture

StatusFileSize
new903 bytes

Did not double check my patch, so now it is well tested and works as expected. I'm sorry.

jepster_’s picture

Status: Postponed (maintainer needs more info) » Fixed

Fixed in 8.x-1.31: https://www.drupal.org/project/permissions_by_term/releases/8.x-1.31

I have used a different code. There has not been an additional class method needed.

Please test and re-open this issue, if you have any objections.

Status: Fixed » Closed (fixed)

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