Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
We have a project where we use the Amazon S3 storage file system, and while testing various things, including deleting files, if an avatar image is not available, and we try to remove it via the admin form, we get this error:
admin/config/people/avatar_selection/edit/og/0?page=0 |
Recoverable fatal error: Argument 1 passed to file_delete() must be an instance of stdClass, boolean given, called in /mnt/www/html/site/docroot/sites/all/modules/contrib/avatar_selection/avatar_selection.admin.inc on line 768 and defined in file_delete() (line 1272 of /mnt/www/html/works/docroot/includes/file.inc).
and deleting the avatar actually fails.
Comment | File | Size | Author |
---|---|---|---|
#1 | check_file_before_delete.patch | 833 bytes | alcroito |
Comments
Comment #1
alcroito CreditAttribution: alcroito commentedAttaching a patch that simply checks that a file exists, before trying to delete it.
Comment #2
federiko_ CreditAttribution: federiko_ commentedI'm using avatar selection in one of my projects and I met the same issue. The patch above worked so thank you! The next step would be to port this patch...