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/Motivation
The access callback has incorrect arguments for at least some taxonomy routes, which leads to exceptions when checking access programmatically.
Steps to reproduce: Check access on a taxonomy url.
$url = \Drupal\Core\Url::fromRoute('entity.taxonomy_vocabulary.collection');
$access = $url->access();
The following exception is then thrown:
RuntimeException: Callable "taxonomy_access_fix_route_access" requires a value for the "$proxy" argument. in Drupal\Component\Utility\ArgumentsResolver->handleUnresolvedArgument() (line 142 of core/lib/Drupal/Component/Utility/ArgumentsResolver.php).
Drupal\Component\Utility\ArgumentsResolver->getArgument(Object) (Line: 54)
Drupal\Component\Utility\ArgumentsResolver->getArguments('\taxonomy_access_fix_route_access') (Line: 66)
Drupal\Core\Access\CustomAccessCheck->access(Object, Object, Object)
call_user_func_array(Array, Array) (Line: 159)
Drupal\Core\Access\AccessManager->performCheck('access_check.custom', Object) (Line: 135)
Drupal\Core\Access\AccessManager->check(Object, Object, NULL, ) (Line: 92)
Drupal\Core\Access\AccessManager->checkNamedRoute('entity.taxonomy_vocabulary.collection', Array, Object) (Line: 809)
Drupal\Core\Url->access(Object) (Line: 162)
I've prioritized the issue as major, because
Cause a significant admin- or developer-facing bug with no workaround.
Proposed resolution
Remove the excess $proxy
argument. It is not used in the implementation and is the cause of the exception.
Remaining tasks
Review. Do we also need a test?
Comment | File | Size | Author |
---|---|---|---|
#2 | taxonomy_access_fix-access_callback_exception-2897480-2.patch | 825 bytes | ckaotik |
Comments
Comment #2
ckaotikI've attached a patch with the proposed change. Please review.
Comment #4
rudiedirkx CreditAttribution: rudiedirkx commentedLooks good. You seem to know what you're doing. Want to take over maintainership?
Comment #5
ckaotik@rudiedirkx Thanks, but I don't really have the time to maintain a project right now. Also, I'm more often just stumbling across bugs, so that's probably just my "luck" ;)
Comment #6
legolasbo