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']);
}
}
| Comment | File | Size | Author |
|---|---|---|---|
| #42 | entity-1312374-42-fatal-error-if-missing-property-callback.patch | 791 bytes | alan d. |
Comments
Comment #1
dgastudio commentedsame problem
Comment #2
amitaibuEdit: Sorry, wrong issue.
Comment #3
Offlein commentedHi, did you guys run update.php?
Comment #4
tabestan commentedI'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 30Running drush updatedb says no updates required.
Edit: I upgraded to countries-7.x-2.x-dev and now I have an error 503...
Comment #5
tabestan commentedWas able to solve it by disabling the offending modules from the database.
Comment #6
tabestan commentedComment #7
jessicakoh commented@Tabestan What was the your offending modules?
Comment #8
tabestan commentedIt was an issue with openlayers.
Comment #9
blasthaus commentedjust adding a
function exists()in the function below from field.info.inc at least got my site back online so I could troubleshoot.Comment #10
Anonymous (not verified) commentedRunning 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]
Comment #11
kenorb commented#2069035: Can't run site update
Comment #12
kenorb commentedSo 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:
Workaround:
or if you're using memcached:
Comment #13
ajzane commentedworked for me
thanks @kenorb
Comment #14
guedressel commentedthanks @kenorb, worked for me too.
Comment #15
fagoThat'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.
Comment #16
alan d. commentedSimilar 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();
Comment #17
mrded commentedAs 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.
Comment #18
alan d. commentedAppears 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.
Comment #19
kenorb commentedComment #20
KeyboardCowboyThis 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.Comment #21
KeyboardCowboyUpdating status
Comment #23
KeyboardCowboyRerolling patch.
Comment #24
KeyboardCowboyComment #25
kenorb commentedComment #26
donutdan4114 commentedWe spent a very long time debugging some issues that this patch fixes.. It works.
Comment #27
TotalNoob commentedNo 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
Comment #29
likewhoa commentedworks for me
Comment #30
alan d. commentedWould 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. :/
Comment #31
fagoI 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.
Comment #32
nerdcore commentedI'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.
Comment #33
arnaldoaa commented#12
worked for me, tks.
Comment #34
briganzia commented#12
Worked also for me on a multisite installation after migration.
Thanks a lot.
Comment #35
acobot commentedI'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?
Comment #36
Nikdhil Mdohfan commented#12 works.
Comment #37
e0ipsoIn case you are caching with Memcached you can use:
Replace
localhostwith your memcached server and11211with your memcached port.Comment #38
generalconsensus commentedThis 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
Comment #39
alan d. commentedNew 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()
Comment #40
jamadar commented#12 works for me, thanks kenorb
Comment #41
robertoperuzzo#12 works! Thank you very much kenorb.
Comment #42
alan d. commentedWatchdog error enough?
Comment #43
lisa.rae commentedI 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.
Comment #44
Matroschker commented- same here today in my system if running update.php because of module update (permission report)
- patch #42 solves this for the moment
Comment #45
generalconsensus commentedComment #46
Donit commented#42 works. Thanks, Alan.
Comment #47
spreadred commented#42 just worked for me as well on Drupal 7.53.
Comment #48
alan d. commentedrtbtc myself, based on the 4 other users comments and no style issues reported in the test results ;)
Comment #49
leistiko_texvet commentedAnother happy thumbs-up for #42. (Drupal 7.56)
Comment #50
slefevre1 commentedRTBC #42 Drupal 7.56 🍥 🚢
Comment #51
agilman commenteddrush sqlq "DELETE FROM cache_field"worked for me. Thanks!Comment #52
slydevil commented#42 also fixed my issue.
Comment #53
millenniumtreeBlew up a site today.
#42 fixed it.
Please release this.
Comment #55
tr commentedCommitted #42.