Hello,

We get this following error when trying to display an earlier revision.

Fatal error: Call to a member function get() on a non-object in www/modules/permissions_by_term/src/KernelEventListener.php on line 34

Steps to reproduce :
- drupal core 8.2.3
- permissions_by_term 8.x-1.08

Go into revisions tab of a node, and click on an earlier revision to display it.

Same error occured when we want to revert an earlier revision.

Thx,

Comments

nicolas.hod created an issue. See original summary.

nicolas.hod’s picture

Priority: Normal » Critical
jozzy_a’s picture

I have added a patch which should fix things.
There is now an additional check to see if the node value contains an array. Revisioned nodes only contain a single value rather than an array.

Joz

jozzy_a’s picture

Status: Active » Needs review
jepster_’s picture

Status: Needs review » Needs work

I cannot see any additonal check by your patch. Also the node variable stays unused because of the immediate return statement after the declaration. This needs work. Personally I would prefer code which is testable by PHPUnit.

jozzy_a’s picture

jozzy_a’s picture

jozzy_a’s picture

Apologies for that jepSter, I didn't export the patch properly.
On comment #7 I have added a patch which checks to see if the node attribute is an array. When it is a node an entity is returned. When it is on the revision pages it only returns a single value.

Joz

  • jepSter committed e4a6952 on 2831836-revisions
    Fix for Issue #2831836 by jozzy_a: Error when displaying an earlier...
jepster_’s picture

Status: Needs work » Fixed

Fixed in 8.x-1.10. Thanks for the solution suggestion and the reporting. Please test the latest version.

Status: Fixed » Closed (fixed)

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

zanvidmar’s picture

Hi, previous patch (#7) is missing closing parenthesis in if sentence. I am adding the new one.

nicolas.hod’s picture

hi,
I tried with 8.x-1.11 version, but with this patch and it solved my problem.

Thx,