The '_file_rename_widget_custom_process()' function implicitly returns NULL if the associated file cannot be loaded. This happens, for example, when a file entity has been deleted but a dangling reference (the 'target_id') still exists in a field.

When this function is used as a Form API '#process' callback, this NULL return value overwrites the form element. This is problematic because if other modules' #process callbacks don't check for a NULL '$element', it leads to fatal 'TypeError' exceptions.

To fix this, the function should always return the '$element' it receives, preventing the element from being nulled in the form processing pipeline.

The error:

TypeError: implode(): Argument #1 ($array) must be of type array, string given in implode() (Zeile xx in /var/www/html/web/modules/contrib/xx/xx.module).

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

dejan0 created an issue. See original summary.

dejan0’s picture

Issue summary: View changes
StatusFileSize
new378 bytes

please find the patch attached

shubham_pareek_19 made their first commit to this issue’s fork.

  • ab5248a5 committed on 1.0.x
    fix: #3564676 _file_rename_widget_custom_process() implicitly returns...
granik’s picture

Status: Needs review » Fixed

Thanks, committed to 1.0.x.

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.