Using the latest dev of file_entity, when I save a node that has a filefield it will throw this error.
Warning: filesize(): stat failed for public://design2themein5.pdf in file_entity_image_dimensions() (line 160 of /home/quickstart/websites/updater.dev/profiles/cmf/modules/contrib/file_entity/file_entity.file.inc).

Also related, if I use @becw "Automatically open the file edit modal after uploading a file" patch http://drupal.org/node/1426730#comment-5766946 I get this error when I save the node.

Warning: filesize(): stat failed for temporary://dsc_0048.jpg in file_entity_image_dimensions() (line 160 of /home/quickstart/websites/updater.dev/profiles/cmf/modules/contrib/file_entity/file_entity.file.inc).
The file dsc_0048.jpg was uploaded

In this case I use the media selector and upload a file. The patch enables me to immediately edit the file that has fields attached. When I save I see the error. To fix this from happening, I can use this commit 0a16da6854f78244be5884cfc9f492deb326234b from Fri, 23 Mar 2012.

In both cases the node and file saves correctly.

Files: 
CommentFileSizeAuthor
#2 1533576-filesize-2.patch941 bytesbc
PASSED: [[SimpleTest]]: [MySQL] 73 pass(es).
[ View ]
#1 1533576-filesize.patch445 bytesbc
PASSED: [[SimpleTest]]: [MySQL] 73 pass(es).
[ View ]

Comments

StatusFileSize
new445 bytes
PASSED: [[SimpleTest]]: [MySQL] 73 pass(es).
[ View ]

Could we use the File interface's filesize object property instead? Patch attached.

StatusFileSize
new941 bytes
PASSED: [[SimpleTest]]: [MySQL] 73 pass(es).
[ View ]

found another filesize(), new patch attached

Thanks @bc, I tested the patch in #2 and it worked as advertised. I no longer receive the errors.

Thanks, Worked for me too!

Status:Active» Needs review

Changing status, as there is a patch.

bookmarking..

Priority:Normal» Major
Status:Needs review» Needs work

Patch removes problem but doesn't do what was intended. Checking the filesize of the file is supposed to protect from PHP warnings.

The file object uses the Drupal default controller for entities, that means that the $file->filesize is loaded from the database, not checked against the file on disk or the remote YouTube clip or whatever your stream wrappers are getting you.

So if the file is gone or has been emptied you can still get a filesize from Drupal but the code in question hasn't protected you from the PHP warning as intended.

This patch might as well comment out the condition as far as I can see.

Status:Needs work» Reviewed & tested by the community

Hmm, checked the history of the original warning and it covers the specific case of uploading a 0-byte file (which would throw the warning). This is correctly checked by this code (worked fine with my empty PNG).

Marking as reviewed and tested.

When the patch will be commited?

Status:Reviewed & tested by the community» Fixed

Status:Fixed» Closed (fixed)

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

Hi,

I have the same issue when linking to flickr images.
Any suggestions?