I've updated from 7.x-1.0-beta3 to 7.x-1.0-beta4 over the past couple of days and noticed that when I now add a new document to a content type where I have added a file field type, on save, the following warning message is displayed:

Warning: Invalid argument supplied for foreach() in filefield_paths_entity_update() (line 248 of /drupal/sites/all/modules/filefield_paths/filefield_paths.module).

This is a cloned development site of a live site that works fine - the only difference I can find is the latest version of this module has changed.

Any ideas?

Comments

deciphered’s picture

Can you try changing 247 to:

if ($enabled && isset($entity->{$field['field_name']}) && is_array($entity->{$field['field_name']})) {

Also, if you feel like doing some debugging for me, let me know, because I'm really curious on how this issue could be occurring.

deciphered’s picture

Status: Active » Fixed

I have committed this, but I would still like to debug further if you are willing.

Status: Fixed » Closed (fixed)

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

jenifertucker’s picture

Sorry for lateness in reply.

I replaced the line and the warning error was not displayed when I created a new content type that I was using to upload a document to :-)

fugazi’s picture

acknowledge error is no longer displayed

genebobmiller’s picture

Version: 7.x-1.0-beta4 » 7.x-1.x-dev
Issue summary: View changes
Status: Closed (fixed) » Needs work

Looks like this was never actually committed?

drasgardian’s picture

Status: Needs work » Needs review
StatusFileSize
new874 bytes

patch attached, adds is_array check as per #1

deciphered’s picture

Status: Needs review » Fixed

Somehow I managed to commit the changelog entry but not the fix itself.

Really committed this time, and added a simpletest for good measure.

  • Deciphered committed 8e36c61 on 7.x-1.x
    #1985280: Added test for no file attached usecase.
    
  • Deciphered committed 97d1850 on 7.x-1.x authored by drasgardian
    #1985280 by Deciphered, drasgardian: Fixed issue with hook_entity_update...
Aurochs’s picture

Great now going to get it tested!
Edit: supreme, it works! thanks. Guess i was right to push the other thread. ;)

Status: Fixed » Closed (fixed)

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