Problem/Motivation

After updating from 8.x-1.0-beta8 to 8.x-1.0-rc1, the following fatal error occurs when saving a file entity:

Error: Call to a member function isEmpty() on array in
Drupal\filefield_paths\Hook\File->filePresave()
(line 43 of /app/web/modules/contrib/filefield_paths/src/Hook/File.php).

Steps to reproduce

- Have a working Drupal site with filefield_paths 8.x-1.0-beta8
- Update to 8.x-1.0-rc1
- Run drush updb but without running drush cr
- Trigger a file save — fatal error occurs

Proposed resolution

Guard against $file->origname being an array before calling ->isEmpty() on it.

CommentFileSizeAuthor
filefield_paths-fix-isempty-on-array.patch606 bytespmkanse
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

pmkanse created an issue. See original summary.

liam morland’s picture

Version: 8.x-1.0-rc1 » 8.x-1.x-dev
Status: Active » Needs review

The test failure is due to trying to test on Drupal 12, which is not supported; see #3592443: Do not test on Drupal 12 ("next major").

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

  • voleger committed 1a77a70f on 8.x-1.x authored by pmkanse
    fix: #3580359 Call to a member function isEmpty() on array in File::...
voleger’s picture

Status: Needs review » Fixed

Thanks

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.