Notices output:
* Notice: Undefined index: file in media_field_formatter_view() (line 152 of /Library/WebServer/Documents/drupal7/modules/media/media.fields.inc).
* Notice: Undefined property: stdClass::$filemime in file_icon_path() (line 781 of /Library/WebServer/Documents/drupal7/modules/file/file.module).
* Notice: Undefined property: stdClass::$filemime in file_icon_map() (line 823 of /Library/WebServer/Documents/drupal7/modules/file/file.module).
* Notice: Undefined property: stdClass::$filemime in file_icon_path() (line 796 of /Library/WebServer/Documents/drupal7/modules/file/file.module).
* Notice: Undefined property: stdClass::$filemime in file_icon_path() (line 796 of /Library/WebServer/Documents/drupal7/modules/file/file.module).
* Notice: Undefined property: stdClass::$filemime in file_icon_path() (line 796 of /Library/WebServer/Documents/drupal7/modules/file/file.module).
* Notice: Undefined property: stdClass::$filemime in file_icon_path() (line 796 of /Library/WebServer/Documents/drupal7/modules/file/file.module).
Steps to reproduce:
Fresh install of Drupal 7.
Install Media and Styles modules.
Enable Media module - automatic enabling of other modules used.
Create a new content type with the following selections
add a Multimedia Asset field
Allowed media types: all
Allowed URI schemes: public (this doesn't seem to matter)
Unlimited number of values.
Create a new node with the new content type.
Upload a single Powerpoint presentation.
Save new node.
View node, see notices above.
It appears that no check is made to be certain filemime type is set. Perhaps that check should occur, and return the default if it's not?
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | stacktrace.txt | 3.03 KB | drzraf |
| #7 | file_icon_path_1.patch | 2.12 KB | dman |
| #4 | file_icon_path.patch | 2.1 KB | droplet |
| #3 | file_icon_path.patch | 2.1 KB | droplet |
| #2 | file_icon_path.patch | 1.94 KB | droplet |
Comments
Comment #1
droplet commentedbug fix & a little optimization
if no $file->filemime defined, skip to last fallback directly.
Comment #2
droplet commentedforgot attach it
Comment #3
droplet commenteda bit better
Comment #4
droplet commentedsorry, too much patch, fix tab problem
Comment #5
droplet commented#4: file_icon_path.patch queued for re-testing.
Comment #6
drzraf commentedI was once able to get these notices in D7, at /admin/config, 5 or 6 occurrences at a time.
but I'm not yet able to reproduce it consistently.
Comment #7
dman commentedThe patch does look like it would fix the described problem. However, seems like it was rolled from the wrong dir (or is very outdated - pre the core folder move)
The steps required to replicate this edge case in a simpletest would be really hard to automate.
My review: yes this is an accurate improvement. Will not introduce any problems. But we'll not be able to prove it works.
Here's a re-roll against current code.
Comment #8
drzraf commentedAttached is a stack trace from D7; patch #4 did not fixed it.
It appears in
<front>in teaser mode, the first node has 1 pdf file attached.The notice appears 3 times before the
/icons/default/application-octet-stream.pngimg is display.(= lines 808, 851 then 823 of file.module)
Please note that in the attached stack trace, the argument n°1 of the function call 24
(Array, 46 elements)is the valid file referenced by the node (though not expanded in the posted trace).I'm using media, "Format" is "Rendered File", View mode: "preview".
The "preview" view mode has not been specified in any fashion in the file types (neither Application nor Others (don't know which one pdf belongs to)), so it should be in its "install state".
in case it helps and relates to this issue.
Comment #9
kscheirer#7: file_icon_path_1.patch queued for re-testing.
Comment #10
kscheirerRetesting against latest HEAD since it has been over a year.
Comment #12
droplet commentedComment #21
quietone commentedfile_icon_path was removed in #2236855: Use CSS for file icons in file fields on Drupal 8.0.x. This is outdated for Drupal 8. However, it is still relevant for Drupal 7.