media_entity_download_count_file_access() doesn't account for empty response from file_get_file_references()

Created on 8 April 2025, about 1 month ago

Problem/Motivation

When calling file_get_file_references() in media_entity_download_count_file_access(), the module doesn't check if the returned value is empty. Without this, the following call occurs with empty variables, resulting in a BSOD:

$download_entity = $entity_type_manager
      ->getStorage($entity_type)
      ->load($entity_id)
      ->bundle();

Steps to reproduce

In one site, this was replicated by having an authenticated user (with no other roles) upload a new profile picture and save their profile.

Proposed resolution

Add checking for empty on either of the two variables. If empty, return.

Remaining tasks

Create patch.

User interface changes

None.

API changes

None.

Data model changes

None.

πŸ› Bug report
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States socketwench

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024