Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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:
- Go to the "manage fields" section of a content entity.
- Click on the "add field" button.
- Under "Reference" select "other".
- Choose a label and click continue.
- Under configuration select "robot".
- Create a content entity containing the created reference field. Select "Marvin, the paranoid android".
- Click save
Proposed resolution:
- Have
RobotAccessController
return anAccessResultInterface
object instead ofTRUE
. See patch in #3. - Write a
BrowserTestBase
test to repeat the steps to reproduce listed above.
Comment | File | Size | Author |
---|---|---|---|
#12 | 2805923_12.patch | 2.65 KB | Mile23 |
| |||
#3 | 2805923_3.patch | 903 bytes | Mile23 |
|
Comments
Comment #1
Anonymous (not verified) CreditAttribution: Anonymous commentedVic Luijkx created an issue. See original summary.
Comment #2
Anonymous (not verified) CreditAttribution: Anonymous commentedComment #3
Mile23Just to confirm that I can repro and this is the error I'm seeing:
I'm also pretty sure it's related to the changes in the patch. It'd be nice to have a test.
Comment #4
Anonymous (not verified) CreditAttribution: Anonymous commentedGood job! Just applied your patch and everything seems to be fine now.
Comment #5
eojthebraveHaven'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.
Comment #6
Mile23Comment #7
jeevanbhushetty CreditAttribution: jeevanbhushetty at QED42 commentedOn it
Comment #8
chetanbharambe CreditAttribution: chetanbharambe commentedComment #9
Mile23Comment #10
Mile23I 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.
Comment #11
Mile23Comment #12
Mile23Test performs all the steps to reproduce from the IS.
Comment #14
Mile23Done. Thanks!