I'm getting the following notice:

Warning: Undefined array key 1 in Drupal\Core\Entity\EntityAccessCheck->access() (line 62 of /var/lib/tugboat/web/core/lib/Drupal/Core/Entity/EntityAccessCheck.php)
#0 /var/lib/tugboat/web/core/includes/bootstrap.inc(346): _drupal_error_handler_real(2, 'Undefined array...', '/var/lib/...', 62)
#1 /var/lib/tugboat/web/core/lib/Drupal/Core/Entity/EntityAccessCheck.php(62): _drupal_error_handler(2, 'Undefined array...', '/var/lib/tugboa...', 62)
#2 [internal function]: Drupal\Core\Entity\EntityAccessCheck->access(Object(Symfony\Component\Routing\Route), Object(Drupal\Core\Routing\RouteMatch), Object(Drupal\Core\Session\AccountProxy))

CommentFileSizeAuthor
#3 3273780-undefined-array-key-02.patch865 bytesanna d

Comments

Anna D created an issue. See original summary.

cilefen’s picture

Status: Active » Postponed (maintainer needs more info)

There is not much to go on there. Can you get us a full stack trace please?

anna d’s picture

Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new865 bytes

The notice and solution is the same as on https://www.drupal.org/project/drupal/issues/3196247
Maybe it is related.

cilefen’s picture

Status: Needs review » Postponed (maintainer needs more info)
Issue tags: +Needs steps to reproduce

As with the other issue we need steps to reproduce this and a full stack trace.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

quietone’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)
Issue tags: +Bug Smash Initiative

It is nice to see a patch but steps to reproduce are needed so that the problem is fully understood and a test can be written. Since that has not been supplied in 11 months, I am closing this issue.

Therefore, closing as cannot reproduce. If you are experiencing this problem on a supported version of Drupal reopen the issue, by setting the status to 'Active', and provide complete steps to reproduce the issue (starting from "Install Drupal core").

stefan lehmann’s picture

Just stumbled over this error message and I'm pretty sure I know the origin of it.

If you define a custom route which checks access like this:

entity.foo.bar:
  path: '/foo/{foo}/bar'
  defaults:
    _form: '\Drupal\module\Form\FooBarForm'
    _title: 'Foo Bar'
  requirements:
    _entity_access: 'foo.view'

In this case I realised that the user needed a different special permission than access to "foo.view" and I mindlessly replaced:

_entity_access: 'foo.view'

with:

_entity_access: 'my special permission'

.. but "my special permission" doesn't work in entity_access as the string is exploded at the "." and as the permission doesn't have a dot you'll get the error message above.

The correct way is to replace it with:

entity.foo.bar:
  path: '/foo/{foo}/bar'
  defaults:
    _form: '\Drupal\module\Form\FooBarForm'
    _title: 'Foo Bar'
  requirements:
    _permission: 'my special permission'

Tldr; if you see this error message thrown somewhere you should probably check your code base for routes using "_entity_access" with a string which doesn't contain dots.