Hello,

Sorry about spamming, but i got one more "bug", it's only a notices but it's annoying.

// @file permissions_by_term/src/Service/AccessStorage.php
// ...
  /**
   * @param array $tids
   *
   * @return array
   */
  public function getUserTermPermissionsByTids($tids) {
    $uids = [];

    foreach ($tids as $tid) {
      $uids[] = array_shift($this->getUserTermPermissionsByTid($tid)); // array_shift causing the notices.
    }

    return $uids;
  }

Create a temp variable for this, more reading:
http://php.net/manual/en/function.array-shift.php

My PHP Version is PHP 7.0

Comments

JonathanFontesCaetsu created an issue. See original summary.

JonathanFontesCaetsu’s picture

Any news about this?

jepster_’s picture

Status: Active » Postponed (maintainer needs more info)

Yesterday I have created an new release: https://www.drupal.org/project/permissions_by_term/releases/8.x-1.28. Is your problem still present there?

JonathanFontesCaetsu’s picture

Ahh sorry, my bad. I will test and later i tell you still exist the issue.

JonathanFontesCaetsu’s picture

Nope, the problem persist. When i change from:

// ... 
/**
   * @param array $tids
   *
   * @return array
   */
  public function getUserTermPermissionsByTids($tids) {
    $uids = [];

    foreach ($tids as $tid) {
      $uids[] = array_shift($this->getUserTermPermissionsByTid($tid));
    }

    return $uids;
  }
//...

to:

// ... 
/**
   * @param array $tids
   *
   * @return array
   */
  public function getUserTermPermissionsByTids($tids) {
    $uids = [];

    foreach ($tids as $tid) {
      $tmp = $this->getUserTermPermissionsByTid($tid);
      $uids[] = array_shift($tmp);
    }

    return $uids;
  }
// ...

I got the error on the next function which is:

// .. /**
   * @param array $tids
   *
   * @return array
   */
  public function getRoleTermPermissionsByTids($tids) {
    $rids = [];

    foreach ($tids as $tid) {
      $rids[] = array_shift($this->getRoleTermPermissionsByTid($tid));
    }

    return $rids;
  }
// ..

And when i switch to this:

// ... 
/**
   * @param array $tids
   *
   * @return array
   */
  public function getRoleTermPermissionsByTids($tids) {
    $rids = [];

    foreach ($tids as $tid) {
      $tmp = $this->getRoleTermPermissionsByTid($tid);
      $rids[] = array_shift($tmp);
    }

    return $rids;
  }
// ...

I got another different error:

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('385', 'modules/contrib/permissions_by_term/src/View/node-details.html.twig') (Line: 221)
permissions_by_term_form_alter(Array, Object, 'node_dicas_edit_form') (Line: 501)

But i think this is another issue... :/

jepster_’s picture

Status: Postponed (maintainer needs more info) » Needs work

Thanks for the reporting. I will check this one asap.

  • Peter Majmesku committed 8327d1f on 8.x-1.x
    Issue #2904706 by JonathanFontesCaetsu: Only variables should be passed...
jepster_’s picture

Status: Needs work » Fixed

I have published the fix in 8.x-1.29: https://www.drupal.org/project/permissions_by_term/releases/8.x-1.29.

Thanks for reporting!

JonathanFontesCaetsu’s picture

Hey,

The error has gone, now can you close the issue. All good. Thanks for the great work.

Status: Fixed » Closed (fixed)

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