Attempting to use any form block with overridden blockAccess() produces a fatal error:

Recoverable fatal error: Argument 1 passed to Drupal\block\BlockAccessControlHandler::mergeCacheabilityFromConditions() must be an instance of Drupal\Core\Access\AccessResult, boolean given, called in /var/www/html/drupal8test/core/modules/block/src/BlockAccessControlHandler.php on line 136 and defined in Drupal\block\BlockAccessControlHandler->mergeCacheabilityFromConditions() (line 151 of /var/www/html/drupal8test/core/modules/block/src/BlockAccessControlHandler.php).

Patch to follow.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

c_lehel created an issue. See original summary.

c_lehel’s picture

Status: Active » Needs review
FileSize
3.33 KB

And here's the patch...

tamarpe’s picture

Status: Needs review » Reviewed & tested by the community

looks good, it works great. Thanks

spuky’s picture

Patch works here too... would be nice to have that committed to a beta or dev version :-)

so +1 for RTBC

malcomio’s picture

Patch works for me too - it's similar to the patch from #2503929: PHP Fatal error: Call to a member function setCacheMaxAge() on a non-object but more complete.

lupka’s picture

Works great, thanks for patch!

eme’s picture

You may want to see work that has been done by the maintainer of the module and me and another dev at #2492285: Enhance for global entity solution and here https://www.drupal.org/project/entity_forms_in_blocks.

kclarkson’s picture

I am also confirming this patch worked. +1 RTCB

pjcarly’s picture

Just tested it myself, confirmed fix!

ricovandevin’s picture

I can confirm that the suggested changes fix the problem.

phponwebsites’s picture

This patch works fine for me.

gnut’s picture

This patch also works fine for me.

mitchalbert’s picture

patch works

guttenbergovitz’s picture

patch works as expected with 8.1.1

veleno’s picture

Patch on #2 confirmed working on Drupal 8.1.2
Thank you

tim.plunkett’s picture

This should likely include some caching information. See core's \Drupal\user\UserAccessControlHandler, with the cachePerPermissions() and cachePerUser() calls.

JimmyAx’s picture

Priority: Normal » Major

Can confirm patch looks good and is working. Should be committed as a lot of users are having this problem.

JimmyAx’s picture

Priority: Major » Critical

Changed my mind. Critical is better as only one out of four forms is working (and it's not the most used).

tim.plunkett’s picture

Issue tags: +Needs tests
mikey_p’s picture

Status: Reviewed & tested by the community » Fixed
FileSize
3.71 KB

The posted patch didn't include any caching information, and for several of these we also need to add relevant cacheTags as well. I've attached the patch I'm committing here, and I'll role a new release immediately after this just to get things working and then circle back on tests in a separate issue.

  • mikey_p committed ef18f67 on 8.x-1.x
    Issue #2570221: blockAccess method should return AccessResult
    

Status: Fixed » Closed (fixed)

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