Hi,

My website is currently unaccessible, I get an error message that seems to be in relation to the Entity module:

Fatal error: Call to undefined function link_field_property_info_callback() in /home/explo635/public_html/sites/all/modules/entity/modules/field.info.inc on line 30

I don't know where to start since I'm a newbe and I don't know much about coding, but the site is down and I need to solve this issue urgently. Thank you so much for your help!!!

Here's the file code related to the error message (field.info.inc):

<?php

/**
 * @file
 * Provides info for fields.
 */

/**
 * Implements hook_entity_property_info() on top of field module.
 *
 * @see entity_field_info_alter()
 * @see entity_entity_property_info()
 */
function entity_metadata_field_entity_property_info() {
  $info = array();
  // Loop over all field instances and add them as property.
  foreach (field_info_fields() as $field_name => $field) {
    $field += array('bundles' => array());
    if ($field_type = field_info_field_types($field['type'])) {
      // Add in our default callback as the first one.
      $field_type += array('property_callbacks' => array());
      array_unshift($field_type['property_callbacks'], 'entity_metadata_field_default_property_callback');

      foreach ($field['bundles'] as $entity_type => $bundles) {
        foreach ($bundles as $bundle) {
          $instance = field_info_instance($entity_type, $field_name, $bundle);

          if ($instance && empty($instance['deleted'])) {
            foreach ($field_type['property_callbacks'] as $callback) {
              $callback($info, $entity_type, $field, $instance, $field_type);
            }
          }
        }
      }
    }
  }
  return $info;
}

/**
 * Callback to add in property info defaults per field instance.
 * @see entity_metadata_field_entity_property_info().
 */
function entity_metadata_field_default_property_callback(&$info, $entity_type, $field, $instance, $field_type) {
  if (!empty($field_type['property_type'])) {
    if ($field['cardinality'] != 1) {
      $field_type['property_type'] = 'list<' . $field_type['property_type'] . '>';
    }
    // Add in instance specific property info, if given and apply defaults.
    $name = $field['field_name'];
    $property = &$info[$entity_type]['bundles'][$instance['bundle']]['properties'][$name];
    $instance += array('property info' => array());
    $property = $instance['property info'] + array(
      'label' => $instance['label'],
      'type' => $field_type['property_type'],
      'description' => t('Field "@name"', array('@name' => $name)),
      'getter callback' => 'entity_metadata_field_property_get',
      'setter callback' => 'entity_metadata_field_property_set',
      'access callback' => 'entity_metadata_field_access_callback',
      'query callback' => 'entity_metadata_field_query',
      'translatable' => !empty($field['translatable']),
      // Specify that this property stems from a field.
      'field' => TRUE,
      'required' => $instance['required'],
    );
    // For field types of the list module add in the options list callback.
    if (strpos($field['type'], 'list') === 0) {
      $property['options list'] = 'entity_metadata_field_options_list';
    }
  }
}

/**
 * Additional callback to adapt the property info for text fields. If a text
 * field is processed we make use of a separate data structure so that format
 * filters are available too. For the text value the sanitized, thus processed
 * value is returned by default.
 *
 * @see entity_metadata_field_entity_property_info()
 * @see entity_field_info_alter()
 * @see entity_property_text_formatted_info()
 */
function entity_metadata_field_text_property_callback(&$info, $entity_type, $field, $instance, $field_type) {
  if (!empty($instance['settings']['text_processing']) || $field['type'] == 'text_with_summary') {
    // Define a data structure for dealing with text that is formatted or has
    // a summary.
    $property = &$info[$entity_type]['bundles'][$instance['bundle']]['properties'][$field['field_name']];

    $property['getter callback'] = 'entity_metadata_field_verbatim_get';
    $property['setter callback'] = 'entity_metadata_field_verbatim_set';
    unset($property['query callback']);

    if (empty($instance['settings']['text_processing'])) {
      $property['property info'] =  entity_property_field_item_textsummary_info();
      // Enable auto-creation of the item, so that it is possible to just set
      // the textual or summary value.
      $property['auto creation'] = 'entity_property_create_array';
    }
    else {
      // For formatted text we use the type name 'text_formatted'.
      $property['type'] = ($field['cardinality'] != 1) ? 'list<text_formatted>' : 'text_formatted';
      $property['property info'] = entity_property_text_formatted_info();
    }
    if ($field['type'] != 'text_with_summary') {
      unset($property['property info']['summary']);
    }
  }
}

/**
 * Additional callback to adapt the property info for term reference fields.
 * @see entity_metadata_field_entity_property_info().
 */
function entity_metadata_field_term_reference_callback(&$info, $entity_type, $field, $instance, $field_type) {
  $property = &$info[$entity_type]['bundles'][$instance['bundle']]['properties'][$field['field_name']];
  if (count($field['settings']['allowed_values']) == 1) {
    $settings = reset($field['settings']['allowed_values']);
    $property['bundle'] = $settings['vocabulary'];
  }
  // Only add the options list callback for controlled vocabularies, thus
  // vocabularies not using the autocomplete widget.
  if ($instance['widget']['type'] != 'taxonomy_autocomplete') {
    $property['options list'] = 'entity_metadata_field_options_list';
  }
  unset($property['query callback']);
}

/**
 * Additional callback to adapt the property info for file fields.
 * @see entity_metadata_field_entity_property_info().
 */
function entity_metadata_field_file_callback(&$info, $entity_type, $field, $instance, $field_type) {
  $property = &$info[$entity_type]['bundles'][$instance['bundle']]['properties'][$field['field_name']];
  // Define a data structure so it's possible to deal with files and their
  // descriptions.
  $property['getter callback'] = 'entity_metadata_field_verbatim_get';
  $property['setter callback'] = 'entity_metadata_field_verbatim_set';

  // Auto-create the field $items as soon as a property is set.
  $property['auto creation'] = 'entity_metadata_field_file_create_item';
  $property['validation callback'] = 'entity_metadata_field_file_validate_item';

  $property['property info'] = entity_property_field_item_file_info();

  if (empty($instance['settings']['description_field'])) {
    unset($property['property info']['description']);
  }
  if (empty($field['settings']['display_field'])) {
    unset($property['property info']['display']);
  }
  unset($property['query callback']);
}

/**
 * Additional callback to adapt the property info for image fields.
 * This callback gets invoked after entity_metadata_field_file_callback().
 * @see entity_metadata_field_entity_property_info().
 */
function entity_metadata_field_image_callback(&$info, $entity_type, $field, $instance, $field_type) {
  $property = &$info[$entity_type]['bundles'][$instance['bundle']]['properties'][$field['field_name']];
  // Update the property info with the info for image fields.
  $property['property info'] = entity_property_field_item_image_info();

  if (empty($instance['settings']['alt_field'])) {
    unset($property['property info']['alt']);
  }
  if (empty($field['settings']['title_field'])) {
    unset($property['property info']['title']);
  }
}

Comments

dgastudio’s picture

same problem

amitaibu’s picture

Title: URGENT - Error message blocking my website's access! » Error message blocking my website's access!
Priority: Critical » Normal

Edit: Sorry, wrong issue.

Offlein’s picture

Hi, did you guys run update.php?

tabestan’s picture

Priority: Normal » Critical

I'm having the same issue right now.

I downloaded again the latest DEV of entity with drush, but can't clear cash or run cron and shows this error:
Fatal error: Call to undefined function countries_field_info_property_callback() in /path/to/sites/all/modules/contrib/entity/modules/field.info.inc on line 30

Running drush updatedb says no updates required.

Edit: I upgraded to countries-7.x-2.x-dev and now I have an error 503...

tabestan’s picture

Was able to solve it by disabling the offending modules from the database.

tabestan’s picture

Priority: Critical » Normal
jessicakoh’s picture

@Tabestan What was the your offending modules?

tabestan’s picture

It was an issue with openlayers.

blasthaus’s picture

just adding a function exists() in the function below from field.info.inc at least got my site back online so I could troubleshoot.

<?php

/**
 * Implements hook_entity_property_info() on top of field module.
 *
 * @see entity_field_info_alter()
 * @see entity_entity_property_info()
 */
function entity_metadata_field_entity_property_info() {
  $info = array();
  // Loop over all field instances and add them as property.
  foreach (field_info_fields() as $field_name => $field) {
    $field += array('bundles' => array());
    if ($field_type = field_info_field_types($field['type'])) {
      // Add in our default callback as the first one.
      $field_type += array('property_callbacks' => array());
      array_unshift($field_type['property_callbacks'], 'entity_metadata_field_default_property_callback');

      foreach ($field['bundles'] as $entity_type => $bundles) {
        foreach ($bundles as $bundle) {
          $instance = field_info_instance($entity_type, $field_name, $bundle);

          if ($instance && empty($instance['deleted'])) {
            foreach ($field_type['property_callbacks'] as $callback) {
              // make sure this function exists otherwise potential fatal error occurs
              if (function_exists($callback)) {
                $callback($info, $entity_type, $field, $instance, $field_type);
              }
              // log the error
              else {
                watchdog('entity', t('Fatal error: Call to undefined function: @function. See line 31 in field.info.inc'), array('@function' => $callback), WATCHDOG_ERROR);
              }
            }
          }
        }
      }
    }
  }
  return $info;
}
?>
Anonymous’s picture

Running into what appears to be the same issue today. Site is still functional, but cannot run update.

I ran drush up and received the following error:

Drush command terminated abnormally due to an unrecoverable error. [error]
Error: Call to undefined function
countries_field_info_property_callback() in
/var/www/html/sites/all/modules/entity/modules/field.info.inc, line
30
PHP Fatal error: Call to undefined function countries_field_info_property_callback() in /var/www/html/sites/al l/modules/entity/modules/field.info.inc on line 30The external command could not be executed due to an applicat ion [error]

kenorb’s picture

kenorb’s picture

Category: support » bug
$ drush -y cc all
Drush command terminated abnormally due to an unrecoverable error.                                                                                                     [error]
Error: Call to undefined function countries_field_info_property_callback() in entity/modules/field.info.inc, line 30

So I can't clear the cache, because of that error.
The only reference to countries_field_info_property_callback() is in cache_field table.

Backtrace:

Stack trace:
  1. {main}() /usr/local/Cellar/drush/5.8/libexec/drush.php:0
  2. drush_main() /usr/local/Cellar/drush/5.8/libexec/drush.php:16
  3. _drush_bootstrap_and_dispatch() /usr/local/Cellar/drush/5.8/libexec/drush.php:61
  4. drush_bootstrap_to_phase($max_phase_index = -2) /usr/local/Cellar/drush/5.8/libexec/drush.php:81
  5. drush_bootstrap_max($max_phase_index = *uninitialized*) /usr/local/Cellar/drush/5.8/libexec/includes/bootstrap.inc:291
  6. drush_bootstrap($phase = 5, $phase_max = 7) /usr/local/Cellar/drush/5.8/libexec/includes/bootstrap.inc:345
  7. _drush_bootstrap_drupal_full() /usr/local/Cellar/drush/5.8/libexec/includes/bootstrap.inc:185
  8. drupal_bootstrap($phase = 7, $new_phase = *uninitialized*) /usr/local/Cellar/drush/5.8/libexec/includes/bootstrap.inc:928
  9. _drupal_bootstrap_full() includes/bootstrap.inc:2218
 10. drupal_theme_initialize() includes/common.inc:5140
 11. drupal_add_js($data = array ('ajaxPageState' => array ('theme' => 'foo', 'theme_token' => '...
 12. url($path = '', $options = array ('prefix' => NULL)) 
 13. drupal_alter($type = 'url_outbound', $data = '', $context1 = array ('prefix' => NULL, 'fragment' => '', 'query' => array (), ...
 14. i18n_page_views_url_outbound_alter($path = '', $options = array ('prefix' => NULL, 'fragment' => '', 'query' => array (), 'absolu...
 15. views_get_all_views($reset = *uninitialized*) 
 16. ctools_export_crud_load_all($table = 'views_view', $reset = FALSE) 
 17. ctools_export_load_object($table = 'views_view', $type = 'all', $args = *uninitialized*) 
 18. _ctools_export_get_defaults($table = 'views_view', $export = array ('identifier' => 'view', 'bulk export' => TRUE, 'primary key' 
 19. comment_views_default_views(array ('identifier' => 'view', 'bulk export' => TRUE, 'primary key' => 'vid', 'default hook' => 'view
 20. views_db_object->new_display($type = 'default', $title = 'Master', $id = 'default') 
 21. views_db_object->add_display($type = 'default', $title = 'Master', $id = 'default') 
 22. views_fetch_plugin_data($type = 'display', $plugin = 'default', $reset = *uninitialized*) 
 23. _views_fetch_plugin_data($type = 'display', $plugin = 'default', $reset = FALSE) 
 24. views_discover_plugins() views/includes/cache.inc:12
 25. entity_views_plugins() views/includes/plugins.inc:41
 26. views_fetch_data($table = *uninitialized*, $move = *uninitialized*, $reset = *uninitialized*) 
 27. _views_fetch_data($table = NULL, $move = TRUE, $reset = FALSE) 
 28. _views_fetch_data_build() 
 29. module_invoke_all($hook = 'views_data') 
 30. call_user_func_array('entity_views_data', array ()) 
 31. entity_views_data() includes/module.inc:895
 32. EntityDefaultViewsController->views_data() 
 33. EntityDefaultViewsController->schema_fields()
 34. entity_get_property_info($entity_type = 'field_collection_item') 
 35. module_invoke_all($hook = 'entity_property_info') 
 36. call_user_func_array('entity_entity_property_info', array ()) 
 37. entity_entity_property_info() includes/module.inc:895
 38. entity_metadata_field_entity_property_info() 

Workaround:

drush sqlq "DELETE FROM cache_field"

or if you're using memcached:

echo 'flush_all' | nc localhost 11211
ajzane’s picture

drush sqlq "DELETE FROM cache_field"

worked for me
thanks @kenorb

guedressel’s picture

thanks @kenorb, worked for me too.

fago’s picture

Status: Active » Postponed (maintainer needs more info)

That's probably some sort of cache-rebuilding issue which with a certain set of modules (and versions). We need to identify the module combination causing the trouble.

alan d.’s picture

Similar error just reported in the countries queue #2293209: Fatal error during update from 7.x-2.1 to 7.x-2.2

Countries 7.x-2.1 up to 7.x-2.1+25-dev with an update that calls cache_clear_all();

mrded’s picture

Status: Postponed (maintainer needs more info) » Closed (duplicate)

As I can see, the problem related with Countries module. It happened because they renamed 'property_callbacks' into hook_field_info.

Do you mind, if I close the task as duplicate? please reopen it if you not happy with it.

#2293209: Fatal error during update from 7.x-2.1 to 7.x-2.2

Thanks.

alan d.’s picture

Status: Closed (duplicate) » Postponed (maintainer needs more info)

Appears like cached results lead to the error. So imho, the core issue appears to be related to the caching of the property callback deep in the chain somewhere by something.

@mrded
I will look at a workaround in the other queue. However, this issue has been reported by multiple modules; link, countries, i18n, .... same issue. Function was defined, then changed / removed, then they get this error. Uncommon, and probably hard to replicate.

kenorb’s picture

Title: Error message blocking my website's access! » Fatal error: Call to undefined function link_field_property_info_callback() in field.info.inc on line 30
KeyboardCowboy’s picture

This scenario produces the issue for me:

1. I developed a 'feature' module locally with custom entities using ECK. The entities have fields provided by the 'money' module.
2. After successful testing locally, I pushed the code to a staging server where the code had not previously existed, thus the DB should have no cached field data.
3. Any drush command fails with the same error the people have been reporting: a function does not exist for a module that has yet to be enabled. In my case, the money module.

I'm not sure yet how this callback is being registered into the property callbacks if the feature containing the entities and fields is disabled along with the module implementing the field, but adding the function_exists() check allows the code to execute so the necessary modules may be enabled.

I've attached a patch with the function_exists() check to get past the issue at least temporarily.

KeyboardCowboy’s picture

Status: Postponed (maintainer needs more info) » Needs review

Updating status

Status: Needs review » Needs work

The last submitted patch, 20: entity_field_property_callback-1312374-20.patch, failed testing.

KeyboardCowboy’s picture

Rerolling patch.

KeyboardCowboy’s picture

kenorb’s picture

Status: Needs work » Needs review
donutdan4114’s picture

Status: Needs review » Reviewed & tested by the community

We spent a very long time debugging some issues that this patch fixes.. It works.

TotalNoob’s picture

No it does not it throws this error afterwards Parse error: syntax error, unexpected '}' in /home/yoursite/public_html/yoursite.com/sites/all/modules/entity/modules/field.info.inc on line 46

likewhoa’s picture

works for me

alan d.’s picture

Would be nice to get this in. I had to reroll a project release (Countries module) after users started complaining about this. Now I am having to leave cruff around in the main module to avoid a fatal error when running the update script. :/

fago’s picture

Status: Reviewed & tested by the community » Needs work

I do not think silently ignoring this is a good idea as it usually means something is wrong. If this happens during upgrade, that's odd and strictly seen a problem of the update code. However, I'm happy to ease things by e.g. throwing a warning only instead of letting it fatal.

nerdcore’s picture

I'm experiencing this error with the callback function `date_entity_metadata_property_info_alter` having updated to date-7.x-2.8.

I had been on Date 7.x-2.6 with Entity API 7.x-1.3 with 1440928_fix_fatal_error_for_entity_tokens-44.patch.

Update to Date 7.x-2.8 has broken Entity API on this site.

I've cleared all cache_ tables in the database. The issue persists.

EDIT: An external cache had captured the bad data. I believe my issue is resolved having removed the external cache. Sorry about that.

arnaldoaa’s picture

#12

drush sqlq "DELETE FROM cache_field

worked for me, tks.

briganzia’s picture

#12

drush sqlq "DELETE FROM cache_field

Worked also for me on a multisite installation after migration.
Thanks a lot.

acobot’s picture

I'm experiencing the issue and wish a permanent solution. The patch in #23 works but are there any reasons why it is not applied to the module release after a year?

Nikdhil Mdohfan’s picture

#12 works.

e0ipso’s picture

In case you are caching with Memcached you can use:

echo 'flush_all' | nc localhost 11211

Replace localhost with your memcached server and 11211 with your memcached port.

generalconsensus’s picture

This is honestly ridiculous, multiple years to wrap critical entity api code in a function_exists check?

Don't misunderstand me, I'm not trying to sound too shrill but this module is so essential to most D7 installs that there are over half a million people using it in the wild.

Please approve and move the #23 patch into a release

alan d.’s picture

New related error, different function in a different module, but the same cause. Uses stale cached data to call a function that doesn't exist that was previously defined via property_callbacks.

Fatal error: Call to undefined function languagefield_property_info_callback()

jamadar’s picture

#12 works for me, thanks kenorb

robertoperuzzo’s picture

#12 works! Thank you very much kenorb.

alan d.’s picture

Status: Needs work » Needs review
StatusFileSize
new791 bytes

I do not think silently ignoring this is a good idea as it usually means something is wrong. However, I'm happy to ease things by e.g. throwing a warning only instead of letting it fatal.

Watchdog error enough?

lisa.rae’s picture

I spent nearly two days chasing this issue that was preventing us from moving forward on a client project. I can confirm that #42 fixed this issue for us. While it may not be a perfect solution, it does address the immediate issue that prevents the usability of any module that uses hook_entity_metadata_property_info() and the resulting defined callback function, especially when you have external caching (like Memcached or Redis), where this is insidious and difficult to track down.

Our particular issue was with the Paragraphs module.

Matroschker’s picture

- same here today in my system if running update.php because of module update (permission report)
- patch #42 solves this for the moment

generalconsensus’s picture

Priority: Normal » Major
Donit’s picture

#42 works. Thanks, Alan.

spreadred’s picture

#42 just worked for me as well on Drupal 7.53.

alan d.’s picture

Status: Needs review » Reviewed & tested by the community

rtbtc myself, based on the 4 other users comments and no style issues reported in the test results ;)

leistiko_texvet’s picture

Another happy thumbs-up for #42. (Drupal 7.56)

slefevre1’s picture

RTBC #42 Drupal 7.56 🍥 🚢

agilman’s picture

drush sqlq "DELETE FROM cache_field" worked for me. Thanks!

slydevil’s picture

#42 also fixed my issue.

millenniumtree’s picture

Blew up a site today.
#42 fixed it.
Please release this.

  • TR committed c3d83f9 on 7.x-1.x authored by Alan D.
    Issue #1312374 by KeyboardCowboy, Alan D.: Fatal error: Call to...
tr’s picture

Status: Reviewed & tested by the community » Fixed

Committed #42.

Status: Fixed » Closed (fixed)

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