Problem/Motivation
A type declaration was added to the arguments of the paragraphs_paragraphs_item_access() function requiring the $entity parameter to be of type ParagraphsItemEntity.
function paragraphs_paragraphs_item_access(ParagraphsItemEntity $entity, $op, $account) {
This causes a PHP TypeError exception when the $entity parameter is NULL. It looks like the type declaration was added in this patch: https://www.drupal.org/project/paragraphs/issues/2854100#comment-13344509
Steps to reproduce
Call the access() function from the EntityValueWrapper of a property of an entity that has a paragraphs field.
EntityValueWrapper->access('view')
In my case, I encountered this issue when using RESTful Web services module (restws) and trying to query for a node resource with a paragraphs field.
Proposed resolution
Make the $entity argument for paragraphs_paragraphs_item_access nullable.
function paragraphs_paragraphs_item_access(?ParagraphsItemEntity $entity, $op, $account) {
Remaining tasks
Issue fork paragraphs-3301655
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #4
immaculatexavier CreditAttribution: immaculatexavier as a volunteer and at Srijan | A Material+ Company for Drupal India Association commentedCommitted with MR in accordance to the proposed resolution
Comment #5
vinmassaro CreditAttribution: vinmassaro commentedRan into an issue where the Rules overview page would no longer load. Patch fixed the issue, thanks. Moving to RTBC