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

Command icon 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

timothywang created an issue. See original summary.

immaculatexavier made their first commit to this issue’s fork.

immaculatexavier’s picture

Status: Active » Needs review

Committed with MR in accordance to the proposed resolution

vinmassaro’s picture

Status: Needs review » Reviewed & tested by the community

Ran into an issue where the Rules overview page would no longer load. Patch fixed the issue, thanks. Moving to RTBC

bluegeek9’s picture

Status: Reviewed & tested by the community » Closed (outdated)
//www.flaticon.com/free-icons/thank-you Thank you for your contribution!

Unfortunately, Drupal 7 is End of Life and no longer supported. We strongly encourage you to upgrade to a supported version of Drupal.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.