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

rjay’s picture

Assigned: Unassigned » rjay
Status: Active » Fixed

Actually 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.

dqd’s picture

perfect.

Status: Fixed » Closed (fixed)

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