Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Notice: Undefined index: semantic_field_instance_format in semantic_fields_preprocess_field() (line 153 of /www/htdocs/*myroot*/sites/all/modules/semantic_fields/semantic_fields.module).
Is caused by certain funny behaviour of php5. PHP 5.x register_globals is being handled a little differently than with 4.x f.e. and it generally prefers a variable to have been initialized before use, or before ask anything.
A work-a-round would be:
// ++ add this code at line 153
else if (isset($instance['semantic_field_instance_format'])) {
if ($instance['semantic_field_instance_format'] == 'default' && $field['semantic_field_format'] == 'default') {
$use_defaults = TRUE;
}
}
instead of
// -- remove this code at line 153
else if ($instance['semantic_field_instance_format'] == 'default' && $field['semantic_field_format'] == 'default') {
$use_defaults = TRUE;
}
}
Comments
Comment #1
rjay CreditAttribution: rjay commentedActually this is a difference between D6 and D7. In Drupal 6, notices are hidden by default (unless you have modifyed the PHP error_reporting ini variable yourself), whereas in Drupal 7, notices are displayed by default. FYI, as far as I know this has nothing at all to do with register_globals.
I've committed a modified version of your suggestion that is also checking that
$field['semantic_field_format']
is set before using it's value. This should prevent the notices from showing up any more.Comment #2
dqdperfect.