Error: Call to a member function isPermanent() on null in _file_rename_widget_custom_process()

Created on 1 August 2024, 4 months ago
Updated 17 September 2024, 2 months ago

Problem/Motivation

Sometimes I can't edit a page with a file field; instead I get a white screen and this error in the logs:
Error: Call to a member function isPermanent() on null in _file_rename_widget_custom_process() (line 170 of /web/modules/contrib/file_rename/file_rename.module).

Turning off the file_rename module, editing & saving the node, and then turning the module back on again sets things right.

Steps to reproduce

I'm not 100% sure yet how to reproduce this error reliably. I think it has to do with a private files field on nodes that, on our site, only appears on nodes that are in private groups (using the group module). If that node is removed from its group, we have code in place to delete any files that were uploaded via that field, and empty out the field itself. Maybe we're missing a piece that file_rename is looking for?

Proposed resolution

It seems like doing a check that $file exists before doing anything with it on line 165 file_rename.module probably wouldn't do any harm?

πŸ› Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States Kasey_MK

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

Comments & Activities

Production build 0.71.5 2024