I get this error after editing a node, adding an attachment and then clicking save:

Fatal error: Call to undefined function field_file_load() in /home/tom/public_html/drupal-6.x/public/sites/playhouseharlow.com/modules/filefield/filefield_field.inc on line 79

Since that, I get a white screen with that error message every time I try to view that node.
(dev snapshot from 26/07)

Comments

drewish’s picture

i'd make sure you're running the latest code... it should be okay.

dopry’s picture

Status: Active » Closed (fixed)

cannot reproduce.

sjf’s picture

I had the same problem. Disabling the Comment RSS module - http://drupal.org/project/commentrss - seemed to fix it.

japanitrat’s picture

same problem here, did not installed commentrss

japanitrat’s picture

seems like problem found in filefield_field() (filefield.module:246), where the filefield_field is loaded and a function inside dynamically gets called. (in this case filefield_field_load which demands field_file_load to be included, which is not)

so I added module_load_include('inc', 'filefield', 'field_file'); in line 247, and the error disappears.

spiffyd’s picture

Disabling Comment RSS did fix it for me as well.

Babalu’s picture

same

igorik’s picture

same problem, don't have comment rss

igorik’s picture

I include full error message in Internet Explorer:

An error occured.
/filefield/ahah/uprofile/field_ikonka/0
<br />
<b>Fatal error</b>: Call to undefined function _filefield_default_value() in <b>/home/... /www/sites/all/modules/filefield_widget.inc</b> on line <b>195</b><br />

nick_vh’s picture

StatusFileSize
new497 bytes

I had the same error on Drupal 6.16 running latest filefield and imagefield (Filefield Dev) and this happened when I upgraded ubuntu to new 10.04.
Not sure if this has anything to do with it but ok!

Fatal error: Call to undefined function field_file_load() in /media/disk/workspace/prive_hortet/www/sites/all/modules/contrib/filefield/filefield_field.inc on line 134

Fix :

Go to filefield.module and add module_load_include('inc', 'filefield', 'field_file'); in line 270
Also a patch in included.

Some debug information :

Drupal 6.16
MySQL database 5.1.41
PHP 5.3.2-1ubuntu4

nick_vh’s picture

StatusFileSize
new497 bytes

Wrong patch (wrongly diffed) - correct patch included here

lelizondo’s picture

Version: 6.x-3.x-dev » 6.x-3.7
Status: Closed (fixed) » Active

I'm getting a similar error, just in another file:

array(4) { ["type"]=>  int(1) ["message"]=>  string(44) "Call to undefined function field_file_load()" ["file"]=>  string(116) "/srv/www/mydomain/public_html/sites/all/modules/contrib/filefield/filefield_widget.inc" ["line"]=>  int(215) } 

I know field_file_load() is in filefield.module, should I add a module_load_include to the function in the .module?

quicksketch’s picture

@lelizondob, opening a new issue probably would've been a better course of action, since this is likely a different cause. What are the steps you use to reproduce this issue? If you're running 3.7, you shouldn't have this problem, at least if it's the same as #807680: APC setting "apc.include_once_override" causes call to undefined function filefield_widget_settings_save().

It seems like recent PHP versions have just started to ignore require and include requests, but I have no idea how or why these files would not be included.

machinez’s picture

I was getting a similar error in Pressflow 6.17. Adding #10 fixed the problem. But I realized the Mercury instance was built on php 5.3 reverted to 5.2. Hack was not needed.

Instructions on downgrading php on Ubuntu 10.04 lucid to karmic
http://www.nickveenhof.be/blog/reverting-or-downgrading-php-53-52-ubuntu...

lelizondo’s picture

Status: Active » Fixed

@quicksketch The problem was related to PHP 5.3, once I downgraded to 5.2.x the problem was solved with no hacks needed. I'm sorry, I just forgot to mark this as fixed.

Status: Fixed » Closed (fixed)

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

brentaar’s picture

Version: 6.x-3.7 » 6.x-3.10
Status: Closed (fixed) » Needs review
StatusFileSize
new1.22 KB

I'm trying to upgrade some servers to PHP 5.3 and in my testing the FileField module was giving me a white screen.

This seems to stem from the different ways PHP 5.2 and 5.3 handle dirname(__FILE__). I tried using drupal_get_path('module','filefield'), which seemed to fix the issue in PHP 5.3. I did some quick testing in PHP 5.2 and it appeared to work properly.

If the patch I'm submitting could be reviewed and then applied, the servers will be one step closer to using PHP5.3.

quicksketch’s picture

We can't use drupal_get_path() because it ultimately requires a database connection. In some situations (such as install profiles), the .module file is loaded before the database connection is available, causing the installation to fail.

Some versions of PHP 5.3 have an issue with the caching of files that are included. See #807680: APC setting "apc.include_once_override" causes call to undefined function filefield_widget_settings_save().

brentaar’s picture

Ok, thanks.

brentaar’s picture

For understanding.

Looking at the drupal_get_path() function it does not require a database connection. It would like one, but it appears to default back to the filesystem if the db connection is not available.

drupal_get_path() uses drupal_get_file(), which can use the DB, but does try other methods.

I'm just trying to understand and not push the issue.

quicksketch’s picture

drupal_get_path() uses drupal_get_file(), which can use the DB, but does try other methods.

Looks like you're correct. I'm not sure if drupal_get_path() had a bug in it at some point or I'm basing my comments off of other problems like #317417: Fix off-line maintenance page since drupal_get_path('theme', 'zen') won't work and #1136820: Allow drupal_get_filename() to work with the installed profile..

Although ultimately I'm still curious why dirname(__FILE__) fails. What difference does it give you between PHP 5.2 and PHP 5.3?

brentaar’s picture

It looks like drupal_get_path() was not following the Drupal hierarchy properly, meaning it was not looking in the correct places for themes and probably profiles, or at least that is what I understand from those bugs.

Following links drupal_get_path() should be fixed in newer versions of Drupal.

For dirname(__FILE__) failing, my guess...something to do with a Magic constant that is not being saved to a variable, when it gets run in APC, that looses the file due to it being in cache.Though what happened from php5.2 to php5.3 change this functionality is unknown to me.

gateway69’s picture

I also ran into this issue, it turns out on my end that apc is also killing __FILE__ I found in my /etc/php5/conf.d/apc.ini that I had apc.include_once_override = 1 set, disabling this and then restarting apache fixed my issue if anyone else is running into this.

from the php site I found this

apc.include_once_override boolean
Optimize include_once() and require_once() calls and avoid the expensive system calls used.
quicksketch’s picture

Status: Needs review » Closed (won't fix)
StatusFileSize
new44.31 KB

I don't think we'll change the include behavior at this point. It seems like PHP may have shipped with this directive enabled (or it was enabled by some hosting providers). PHP now provides a nice huge error basically saying "don't use apc.include_once_override": http://www.php.net/manual/en/apc.configuration.php#ini.apc.include-once-...

So basically, I think this boiled down to a PHP bug that we shouldn't be accommodating for.