I’m mentioning this issue here just in case somebody else runs into the same problem. I’ve spent a few hours trying to track down the context that fire up these notices.
For an entityform with a file field, if that file field is displayed in the email display mode with “Generic file” format or “Table of files” format, the following notices will show up after form submission. No other entityforms settings influence this but the email display mode.
• Notice: Undefined property: stdClass::$uri in theme_file_link() (line 727 of ...\public\modules\file\file.module).
• Notice: Undefined property: stdClass::$filemime in theme_file_icon() (line 765 of ...\public\modules\file\file.module).
• Notice: Undefined property: stdClass::$filemime in file_icon_path() (line 809 of ...\public\modules\file\file.module).
• Notice: Undefined property: stdClass::$filemime in file_icon_map() (line 852 of ...\public\modules\file\file.module).
• Notice: Undefined property: stdClass::$filemime in file_icon_path() (line 824 of ...\public\modules\file\file.module).
• Notice: Undefined property: stdClass::$filemime in file_icon_path() (line 824 of ...\public\modules\file\file.module).
• Notice: Undefined property: stdClass::$filemime in file_icon_path() (line 824 of ...\public\modules\file\file.module).
• Notice: Undefined property: stdClass::$filemime in file_icon_path() (line 824 of ...\public\modules\file\file.module).
• Notice: Undefined property: stdClass::$filemime in theme_file_link() (line 734 of ...\public\modules\file\file.module).
• Notice: Undefined property: stdClass::$filesize in theme_file_link() (line 734 of ...\public\modules\file\file.module).
• Notice: Undefined property: stdClass::$filename in theme_file_link() (line 740 of ...\public\modules\file\file.module).
• Notice: Undefined index: filesize in theme_file_formatter_table() (line 1011 of ...\public\modules\file\file.field.inc).
Comment | File | Size | Author |
---|---|---|---|
#12 | drupal_1967176-12_avoid_file_notices.patch | 707 bytes | Michelle |
Comments
Comment #1
johndp CreditAttribution: johndp commentedany fix for this? ideally, we would like to display a link to download an uploaded file in the notification email.
Comment #2
drhey CreditAttribution: drhey commentedFWIW, I was getting similar errors upon submission of an entityform (with a file upload field). However, when I removed a specific node submission rule that I crafted, the error message went away. The error message wasn't verbatim to the one posted here, but a google search of the syntax I was seeing led me here. So, I figured I'd contribute what little information I've gathered thus far. HTH!
Comment #3
CodigoVision CreditAttribution: CodigoVision commentedI'm getting the same errors. Anyone find a fix?
Comment #4
salvisI see the same thing when I upload a .pdf file into a File field in a new comment and then preview the comment.
Entityform is not on that site.
Comment #5
DrCord CreditAttribution: DrCord commentedI also am getting this problem and am not using entity_form
Comment #6
DrCord CreditAttribution: DrCord commentedWorth noting: this only happens for comments, not nodes themselves. So for example on a forum topic preview works fine, but on the comments to it preview has this exact problem.
Comment #7
DrCord CreditAttribution: DrCord commentedI added this code to the function `theme_file_link`
after
and before:
If anyone else will benefit I can put a patch up.
Comment #8
salvisThanks for looking into it.
Having a patch against HEAD would be a first step towards getting a fix.
Also, knowing whether the issue is still present in D8 would define the scope.
Comment #9
cockers CreditAttribution: cockers commentedI found this from a websearch and just wanted to let you know that this also happens when uploading via an editable field in a view.
All I needed to do to remove the error messages was to change the display setting to display URL.
Comment #10
salvisThe theme_file_link() function expects to get
It's the caller's fault if they don't pass a fully populated file object. #7 may fix the symptoms, but it needs to be fixed at the calling site.
Comment #11
dhruveshdtripathi CreditAttribution: dhruveshdtripathi as a volunteer commentedI faced the same error. And my mistake was, I deleted the file from /admin/content/file but didn't delete the node with which the file was attached. Deleting the node solves the error.
Comment #12
MichelleI agree with #10 that it should be fixed upstream but that's not always possible. In my case, it seems to be that Views isn't recognizing the file field has nothing in it so it's sending an empty file object to be rendered. This may not be the best way to fix it and likely won't ever be committed but it at least prevents the logs from filling up with notices.
This patch is a variation on the code in #7. In my case, I have a totally empty file object so my original code just bailed. Seeing #7, I added in an attempt to load it for folks that have the fid but not the rest.
Comment #13
poker10 CreditAttribution: poker10 at ActivIT s.r.o. commentedThanks for reporting this. I was able to simulate the problem with steps from the comment #4, therefore it seems to be a Drupal core problem (or at least a part of it is). I think that the patch #12 is not the best solution, as it will only mask the problem on the caller side (Drupal core should not babysit broken code).
But I think we can at least try to fix the problem with comment preview (see #4) and then see if the notices will be still there when using the
entity_form
and mail display mode.Anyway, we would need a test here.
Comment #14
poker10 CreditAttribution: poker10 at ActivIT s.r.o. commentedFor the comment preview, it should be sufficient to add a
_field_invoke_multiple()
, as it is mentioned here: #1678686-26: Notice: Undefined index: uri in image_field_formatter_view(). Therefore I am not sure if the rest of the issue is a core problem instead of theentity_form
? Probably it can be moved back toentity_form
queue?