Problem/Motivation

When programmatically deleting taxonomy terms, deleting the Path Alias, the $cid is NULL and the following error appears:
[error] Argument 1 passed to Drupal\filecache\Cache\FileSystemBackend::getFilename() must be of the type string, null given, called in /Users/x/websites/projectname/web/modules/contrib/filecache/src/Cache/FileSystemBackend.php on line 171

I propose to do an additional check to check if the cid is not null.

CommentFileSizeAuthor
#2 filecache-3255584-2.patch626 bytesstijnstroobants

Issue fork filecache-3255584

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

StijnStroobants created an issue. See original summary.

stijnstroobants’s picture

StatusFileSize
new626 bytes
stijnstroobants’s picture

Status: Active » Needs review
pfrenssen’s picture

This is in principle a bug in the calling code, but since the core interface CacheBackendInterface::delete() only documents that $cid should be a string but does not enforce the type I think it is OK for us to harden this code so the request doesn't crash.

pfrenssen’s picture

Issue tags: +DevDaysAthens2026

  • pfrenssen committed 18d0c255 on 8.x-1.x
    fix: #3255584 Argument 1 passed to Drupal\filecache\Cache\...
pfrenssen’s picture

Thanks for the report. I implemented the hardening on all methods that implement the public interface and have a $cid argument. Since this is indicative of a bug in calling code I made sure to emit an error in the logs including a backtrace so the bug can be discovered and fixed by the developer.

pfrenssen’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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