Problem/Motivation

On PHP 8.5, two deprecation warnings are triggered when visiting any entity form that has a Flag field, caused by null being used as an array offset in FlaggingStorage. This happens because $account->id() returns null in certain contexts (e.g. anonymous users), and that value is then used as a key in the static cache arrays inside loadIsFlagged() and loadIsFlaggedMultiple().

Steps to reproduce

  • Install Drupal with PHP 8.5
  • Install the Flag module
  • Create a flag and enable it on a content type
  • Visit an entity form for that content type
  • Observe deprecation warnings in the logs

Issue fork flag-3584450

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

ewout goosmann created an issue.

ewout goosmann changed the visibility of the branch 3584450-php-8.5-- to hidden.

ewout goosmann changed the visibility of the branch 3584450-php-8.5-- to active.