Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
in file_field.inc the following code wrongly adds errors to watchdog
// Verify the file exists on the server.
if (!empty($item['filepath']) && !file_exists($item['filepath'])) {
watchdog('filefield', 'FileField was trying to display the file %file, but it does not exist.', array('%file' => $item['filepath']), WATCHDOG_WARNING);
}
$item['filepath'] is the path relative to drupals "files" folder but the PHP function file_exists will look for $item['filepath'] as an absolute URL.
Comments
Comment #1
charlie-s CreditAttribution: charlie-s commentedThis is true and loads up the dblog with tons of errors that are not really errors.
Comment #2
quicksketchUnfortunately $item['filepath'] is NOT relative to the files directory. It's always either A) relative to the Drupal root (if using public files) or B) absolute on the entire file system (if using private files). Drupal didn't start storing relative file paths based on the file directory until Drupal 7 through use of stream wrappers. The fact that Drupal stores the whole file path is exactly why so many people have problems when they try to move their file directory location.
Comment #3
charlie-s CreditAttribution: charlie-s commentedI'm using public files and have not moved my files directory since I initially installed and configured Drupal. It is "files". In my case an example error would be "FileField was trying to display the file
files/product-bulletin.pdf
, but it does not exist." Of course, the file exists.Comment #4
seanrI'm seeing a lot of these too, and have not moved the site or anything. The location reported in the errors is almost always /poormanscron/run-cron-check.
Comment #5
Rhino-new CreditAttribution: Rhino-new commentedI'm getting this error at nearly every single page-load, including /admin/content
Comment #6
pwolanin CreditAttribution: pwolanin as a volunteer commented