Problem:

Referencing a robot config entity causes the following error:

TypeError: Argument 1 passed to Drupal\Core\Access\AccessResult::orIf() must implement interface Drupal\Core\Access\AccessResultInterface, boolean given, called in /core/lib/Drupal/Core/Entity/EntityAccessControlHandler.php on line 93 in Drupal\Core\Access\AccessResult->orIf() (line 282 of /core/lib/Drupal/Core/Access/AccessResult.php).

Steps to reproduce:

  1. Go to the "manage fields" section of a content entity.
  2. Click on the "add field" button.
  3. Under "Reference" select "other".
  4. Choose a label and click continue.
  5. Under configuration select "robot".
  6. Create a content entity containing the created reference field. Select "Marvin, the paranoid android".
  7. Click save

Proposed resolution:

  • Have RobotAccessController return an AccessResultInterface object instead of TRUE. See patch in #3.
  • Write a BrowserTestBase test to repeat the steps to reproduce listed above.
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Anonymous’s picture

Vic Luijkx created an issue. See original summary.

Anonymous’s picture

Issue summary: View changes
Mile23’s picture

Status: Active » Needs review
FileSize
903 bytes

Just to confirm that I can repro and this is the error I'm seeing:

[25-Sep-2016 16:11:33 Europe/Berlin] Recoverable fatal error: Argument 1 passed to Drupal\Core\Access\AccessResult::orIf() must implement interface Drupal\Core\Access\AccessResultInterface, boolean given, called in /Users/paulmitchum/projects/drupal8/core/lib/Drupal/Core/Entity/EntityAccessControlHandler.php on line 93 and defined in /Users/paulmitchum/projects/drupal8/core/lib/Drupal/Core/Access/AccessResult.php on line 282

I'm also pretty sure it's related to the changes in the patch. It'd be nice to have a test.

Anonymous’s picture

Good job! Just applied your patch and everything seems to be fine now.

eojthebrave’s picture

Haven't had a chance to dig into this to much yet, but for anyone that's looking to write tests for this \Drupal\system\Tests\Entity\EntityReferenceSelection\EntityReferenceSelectionAccessTest might be a good example starting point.

Mile23’s picture

Issue summary: View changes
Status: Needs review » Needs work
Issue tags: +Needs tests
jeevanbhushetty’s picture

Assigned: Unassigned » jeevanbhushetty

On it

chetanbharambe’s picture

Mile23’s picture

Assigned: chetanbharambe » Unassigned
Mile23’s picture

Title: Config entity reference field causes error. » Test adding robot config entity as a reference.

I can't repro the problem, because we did this change in #2951260: Argument 1 passed to Drupal\Core\Access\AccessResult::orIf()

It would still be nice to have a test.

Rescoping.

Mile23’s picture

Mile23’s picture

Status: Needs work » Needs review
FileSize
2.65 KB

Test performs all the steps to reproduce from the IS.

  • Mile23 committed af7f506 on 8.x-1.x
    Issue #2805923 by Mile23, Vic Luijkx, eojthebrave: Test adding robot...
Mile23’s picture

Status: Needs review » Fixed

Done. Thanks!

Status: Fixed » Closed (fixed)

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