I have have no end of issues with this module and PHP 5.3 (specifically 5.3.2-1ubuntu4) running on Ubunutu 10.04. I have added a few hacks, as described in these previous issues by adding in

module_load_include('inc', 'filefield', 'filefield_field');

into filefield.module (lines 254 and 273).

Upon creating a new field for a CCK content type (File -> Image), I get the following error:

Fatal error: Call to undefined function filefield_widget_settings_save() in /var/www/sites/all/modules/filefield/filefield.module on line 291

Has anyone had any experience with this? Any solutions?

Thanks in advance
Sean

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

quicksketch’s picture

I don't think the problems you're describing are PHP 5.3 issues. That said, I'm not sure how you're getting these errors at all. The widget file should be pulled immediately on all requests, since filefield.module includes these lines right at the top of the file:

// FileField API hooks should always be available.
include_once dirname(__FILE__) . '/field_file.inc';
include_once dirname(__FILE__) . '/filefield_widget.inc';
wiifm’s picture

Well, I have a Windows XAMPP stack running PHP 5.2 and there are no issues, but porting the exact same code to a Linux based box running PHP 5.3, there are multiple show stoppers (i.e. break critical functionality, and produce WSOD with a PHP error).

See issue #288570: Fatal error: Call to undefined function field_file_load() - for other people running Ubuntu 10.04 with filefield issues

Thanks
Sean

quicksketch’s picture

So is that include line not getting executed? Does Ubuntu come with some kind of op-code cache like APC, XCache, or eAccelerator?

wiifm’s picture

Ubuntu does not come with a default PHP opcode accerator, but I have enabled APC on the server using PECL.

jstamper’s picture

So is that include line not getting executed? Does Ubuntu come with some kind of op-code cache like APC, XCache, or eAccelerator?

I like wiifm69 was having a lot of weird filefield errors after upgrading to 10.04. My issue was with APC, I had

apc.include_once_override = 1

set in php.ini. It worked fine in php 5.2.x but it broke filefield when I moved to 10.04 with PHP 5.3. Hope this helps somebody.

quicksketch’s picture

Thanks jstamper, that sounds very useful. I wonder if we could correct the problem by changing include_once to require_once?

jstamper’s picture

I had temporarily fixed the issue using module_load_include() which uses require_once instead of include_once so it might not be a bad idea.
Jim

quicksketch’s picture

Thanks, that sounds like it might work then. I should note that module_load_include() should not be used directly in module files (outside of any functions) because it ultimately queries the database to get the module location. This causes installation profiles to fail, since they don't have access to the database when the Drupal site is initially installed. That's the reason for our funky use of dirname(__FILE__) instead of the more typical module_load_include().

wiifm’s picture

Thanks @jstamper,

Edited /etc/php5/conf.d/apc.ini set

apc.include_once_override = 0

restarted apache, and it all worked.

quicksketch’s picture

Version: 6.x-3.3 » 6.x-3.5
Status: Active » Fixed
FileSize
686 bytes
1.92 KB

I've committed the attached patches to both ImageField and FileField, which effectively switches all calls to include_once with require_once.

quicksketch’s picture

Title: Call to undefined function filefield_widget_settings_save() » APC setting "apc.include_once_override" causes call to undefined function filefield_widget_settings_save()

Status: Fixed » Closed (fixed)

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

jason.fisher’s picture

FYI -- still have the error with PHP 5.2 and APC's include_once directive and require_once in the PHP. It works fine with APC if I use a plain 'include' function in filefield.module instead..

HongPong’s picture

I tried switching to dev version and have had this problem with APC and PHP5.3. per wiifm69 suggestion i set apc.include_once_override = 0
and it seems better. woot

bluesomewhere’s picture

There seems to be a general issue with apc.include_once_override and PHP 5.3 -- it had been raising hell in my Drupal 7 install until I discovered this post.

I had issues with a range of modules, including Feeds, CTools, and Date, where an include/require once would be completely ignored, and I'd get undefined function calls left and right.

jghyde’s picture

#9 worked for me.

drupalninja99’s picture

I had the EXACT same issue and I was pulling my hair out, this worked exactly THANKS!

jason.fisher’s picture

I believe PHP 5.3 has improvements that dampen the past advantages of include_once_override.

quicksketch’s picture

The PHP people have stated (as recently as December at least) that you just shouldn't use this option at all: https://bugs.php.net/bug.php?id=58469

jenlampton’s picture

Just a note that if you are using MAMP and have the caching option set to XCache you will have this same problem. Turn it off and all will be happy :)