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?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ckaotik created an issue. See original summary.

ckaotik’s picture

Assigned: ckaotik » Unassigned
Status: Active » Needs review
FileSize
825 bytes

I've attached a patch with the proposed change. Please review.

  • rudiedirkx committed 77329aa on 8.x-2.x authored by ckaotik
    Issue #2897480 by ckaotik: Arguments on access callback cause exception
    
rudiedirkx’s picture

Looks good. You seem to know what you're doing. Want to take over maintainership?

ckaotik’s picture

@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" ;)

legolasbo’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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