If creating a new oEmbed image using the oEmbed module, we get a couple of Notices:
Notice: Undefined property: stdClass::$image_dimensions in file_entity_file_update() (line 70 of /Users/esben/www/dr3/sites/all/modules/contrib/file_entity/file_entity.file.inc).
Notice: Undefined property: stdClass::$image_dimensions in file_entity_file_update() (line 70 of /Users/esben/www/dr3/sites/all/modules/contrib/file_entity/file_entity.file.inc).
This is because the file entity for oembed content has the filesize 0 which means that the image_dimensions are not set in file_entity_image_dimensions().
But in file_entity_file_update() it assumes that the property has been set.
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | test-with-fix-1922444-10.patch | 5.28 KB | devin carlson |
| #10 | test-without-fix-1922444-10.patch | 4.46 KB | devin carlson |
| #1 | file_entity-notice_undefined_image_dimensions-1922444-1.patch | 836 bytes | esbenvb |
Comments
Comment #1
esbenvb commentedHere's a patch that solves it.
Important! When porting the patch make sure that the correct author information is used as described on http://drupal.org/user/989064
Comment #2
adamtong commentedIt is a similar issue? http://drupal.org/node/1939828
But the path cannot help my case.
Comment #3
dave reidComment #4
dave reidComment #5
aaron commented#1: file_entity-notice_undefined_image_dimensions-1922444-1.patch queued for re-testing.
Comment #6
aaron commentedDuring my testing I was unable to replicate the issue. Has it been fixed elsewhere? I used several Flickr images with the oEmbed modules for testing.
Comment #7
dave reidI've only been able to replicate this when there were other things going wrong, like doing something like this:
$file = file_load('50000000') // A file ID that does not exist. This assigns $file to FALSE.
file_save($file); // Calling this on not a file object causes the errors.
Comment #8
esbenvb commentedIt might have been fixed in elsewhere in the meantime, but I still think it is a good thing to should do a check for the mentioned image_dimensions properties before reading their values, in case they haven't been set for some reason.
Comment #9
aaron commentedI don't know what added value adding this patch will give in light of the fact that we are not able to replicate the issue. On the other hand it doesn't really add much in processing time so I'm not averse to adding it, however note that #1496942: Support making any kind of meta-data available to file_load() and file_load_multiple() consumers will likely make this patch obsolete anyway.
Comment #10
devin carlson commentedI actually came across this while working on a patch for #1977662: On fresh install, existing files are assigned to 'undefined' file type.
As aaron mentioned in #9, this will go away with #1496942: Support making any kind of meta-data available to file_load() and file_load_multiple() consumers so it should be fine to add for now until that issue is fixed.
I've attached patches for #1977662: On fresh install, existing files are assigned to 'undefined' file type (which include tests): one with the fix in #1 and one without. This should demonstrate that this is a reproducible issue.
Comment #12
aaron commentedYes, that demonstrates the issue. It looks good to me so let's get this in.
Comment #13
devin carlson commentedGreat! Committed #1 to 7.x-2.x.