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.
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.
Comment | File | Size | Author |
---|---|---|---|
#20 | 2570221-formblock-access_result_block_access-20.patch | 3.71 KB | mikey_p |
#2 | formblock-block-access-2570221-1.patch | 3.33 KB | c_lehel |
Comments
Comment #2
c_lehel CreditAttribution: c_lehel commentedAnd here's the patch...
Comment #3
tamarpe CreditAttribution: tamarpe commentedlooks good, it works great. Thanks
Comment #4
spuky CreditAttribution: spuky commentedPatch works here too... would be nice to have that committed to a beta or dev version :-)
so +1 for RTBC
Comment #5
malcomio CreditAttribution: malcomio commentedPatch 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.
Comment #6
lupka CreditAttribution: lupka commentedWorks great, thanks for patch!
Comment #7
eme CreditAttribution: eme at emerya commentedYou 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.
Comment #8
kclarkson CreditAttribution: kclarkson commentedI am also confirming this patch worked. +1 RTCB
Comment #9
pjcarly CreditAttribution: pjcarly commentedJust tested it myself, confirmed fix!
Comment #10
ricovandevin CreditAttribution: ricovandevin at Finlet, Randstad Digital commentedI can confirm that the suggested changes fix the problem.
Comment #11
phponwebsites CreditAttribution: phponwebsites commentedThis patch works fine for me.
Comment #12
gnut CreditAttribution: gnut commentedThis patch also works fine for me.
Comment #13
mitchalbert CreditAttribution: mitchalbert at Betawerk commentedpatch works
Comment #14
guttenbergovitz CreditAttribution: guttenbergovitz as a volunteer commentedpatch works as expected with 8.1.1
Comment #15
veleno CreditAttribution: veleno commentedPatch on #2 confirmed working on Drupal 8.1.2
Thank you
Comment #16
tim.plunkettThis should likely include some caching information. See core's \Drupal\user\UserAccessControlHandler, with the cachePerPermissions() and cachePerUser() calls.
Comment #17
JimmyAx CreditAttribution: JimmyAx commentedCan confirm patch looks good and is working. Should be committed as a lot of users are having this problem.
Comment #18
JimmyAx CreditAttribution: JimmyAx commentedChanged my mind. Critical is better as only one out of four forms is working (and it's not the most used).
Comment #19
tim.plunkettComment #20
mikey_p CreditAttribution: mikey_p commentedThe 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.