Here's the error:

Fatal error: Call to undefined function _filefield_source_attach_file_path_validate() in /home/xxx/xxx/includes/form.inc on line 1410

This is on a Drupal 7.20 installation.

We could replicate the error by creating a new content type and adding only an image field. None of the options under "enabled sources" need to be checked. On hitting the save settings button on the field properties form, the above error is produced.

We found that this error would NOT be produced if the field type was a "file".

This led us to consider what other modules might be hooked into the image data type. We uninstalled a module called "Lightbox 2". The symptom disappeared. We replaced the "Lightbox 2" module with "Colorbox". All was well. Until...

We installed the FlexSlider Module. The same symptoms as before reappeared.

I have another Drupal 7.20 installation with FileField Sources, Colorbox, and FlexSlider which works fine.

Another notable module installed on the problem install is Ubercart.

I know that the recent 7.20/7.21 release is introducing changes to the image module, I wonder if this has any bearing on this situation.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

quicksketch’s picture

Thanks for the report. I think this problem is probably not related to any of the most recent changes, but different versions of Drupal and different installations of modules may be the reason why this is only showing up on some of your sites (and I've never seen it at all). Sometimes when Drupal submits and validates a form, it doesn't rebuild the whole form. Since the build function is what loads the sources/attach.inc file (which contains the _filefield_source_attach_file_path_validate() function), if the build function gets skipped and Drupal uses a cached version, the error occurs that you're seeing.

There's a FormAPI property or $form_state key for making sure all the necessary files are loaded, but I can't recall it at the moment. Something like $form_state['build_files'] or something. We need to set that property to ensure all the necessary sub-files are included on validation/submit.

collier.matthew’s picture

Intermittent problems after my initial post. The most obvious difference between the site that was working and the one that was not was the Ubercart module.

Immediately after disabling the Ubercart module(s), all the symptoms we were observing at that moment disappeared.

I'll report back as the situation develops.

collier.matthew’s picture

This issue has not reappeared since Ubercart was disabled.

quicksketch’s picture

Title: Fatal error: Call to undefined function _filefield_source_attach_file_path_validate() » Load includes for validation (Fatal error: Call to undefined function _filefield_source_attach_file_path_validate)
Status: Active » Fixed
FileSize
6.32 KB

I've committed this patch which makes FileField Sources utilize form_load_include() for each include when displaying a settings or field form for that source. Since I never encountered this problem myself, I can't confirm that it would solve the problem, but logically, it seems that this should do the trick. Please let me know if it seems this problem is fixed (or not) in the 1.8 release when it comes out.

Status: Fixed » Closed (fixed)

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

Ram_doss’s picture

Version: 7.x-1.7 » 7.x-1.8

If i try to use this remote url on a image field, while trying to save that image field i am getting this error.

Fatal error: Call to undefined function _filefield_source_attach_file_path_validate() includes/form.inc on line 1410

What should i do?

carolineboivin’s picture

Version: 7.x-1.8 » 7.x-1.9
Issue summary: View changes
Status: Closed (fixed) » Active

I get the same error message when trying to save an image field : Fatal error: Call to undefined function _filefield_source_attach_file_path_validate() in /xx/xx/includes/form.inc on line 1411. Running Drupal 7.23

rakesh.nimje84@gmail.com’s picture

I am also facing the same issue running Drupal 7.26. Any help would be appreciated in advance.

Anybody’s picture

Same problem here with the latest Drupal version.

Softwar’s picture

Hello,

I found a solution for this issue.

The solution is that the name of directory for .inc files isn't a good name. For each .inc files into "sources", you must change hook_filefield_source_info() like that, for example :

function filefield_source_attach_info() {
  $source = array();
  $source['attach'] = array(
    'name' => t('File attach from server directory'),
    'label' => t('File attach'),
    'description' => t('Select a file from a directory on the server.'),
    'process' => 'filefield_source_attach_process',
    'value' => 'filefield_source_attach_value',
    'weight' => 3,
    - 'file' => 'includes/attach.inc',
    + 'file' => 'sources/attach.inc',
  );
  return $source;
}

The commit that introduce this problem is http://cgit.drupalcode.org/filefield_sources/commit/?id=fe1016a

I don't understand why the name of this directory has been changed?

Best regards.

wranvaud’s picture

Thx Softwar, that seems to be it!

davej’s picture

+1 for #10, which fixes a clear error in http://cgit.drupalcode.org/filefield_sources/commit/?id=fe1016a
Would it be possible to get this committed, please?

Regards,

Dave

klokie’s picture

Priority: Normal » Major

Same here. Looks to me like maybe the fix was never committed to 7.x-1.9. Can we get a new release please?

Plazik’s picture

Disabling and enabling module helped me.

Softwar’s picture

Status: Active » Needs review
Softwar’s picture

Hello,

I've added a patch because the changements wouldn't commit by the principal mainteners.

It's a solution in wait that the module has been modify.

Enjoy :)

DamienMcKenna’s picture

Version: 7.x-1.9 » 7.x-1.x-dev
Status: Needs review » Reviewed & tested by the community
Parent issue: » #2530654: Plan for FileField_Sources 7.x-1.10 release

Looks reasonable.

  • profak committed 17972e2 on 7.x-1.x authored by Softwar
    Issue #1936836 by Softwar: Load includes for validation errors.
    
profak’s picture

Status: Reviewed & tested by the community » Fixed

Thanks everyone!

Patch #16 applied to 7.x-1.x.

profak’s picture

Status: Fixed » Closed (fixed)

In 7.x-1.10.