Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
With Private Files enabled in OS X with PHP 5.3 and Content, Filefield, and Imagefield enabled in Pressflow Drupal 6....
After saving a node with a new image attached:
Notice: Trying to get property of non-object in filefield_file_download() (line ... of ... filefield.module)
In my debugger $file
is showing up as a bool with a value of 0 at line 137 of HEAD. I guess that 0 means NULL? Because changing
// If the file is not found in the database, we're not responsible for it.
if (!isset($file)) {
return;
}
to
// If the file is not found in the database, we're not responsible for it.
if (empty($file)) {
return;
}
resolves the issue.
OK?
Comment | File | Size | Author |
---|---|---|---|
#1 | filefield-996338.patch | 549 bytes | Soren Jones |
Comments
Comment #1
Soren Jones CreditAttribution: Soren Jones commentedPatch.
Comment #2
Soren Jones CreditAttribution: Soren Jones commentedComment #3
quicksketchHm, interesting. I wonder if isset() has ever really worked here. Clearly empty() is going to be a more robust check here. You running into this problem is enough that I think this change should be made regardless of if it works in some situations.
Comment #4
quicksketchI've committed this patch. Thanks again.