When I enable Entity and then enable Rules and then return to the modules page I get:
Fatal error: Unsupported operand types in /home/everlast/public_html/take5/sites/all/modules/entity/entity_metadata/modules/field.info.inc on line 19

For what it's worth that line is:

   $field_type = field_info_field_types($field['type']) + array('property_callbacks' => array());

This is with rules-7.x-2.0-alpha3 and Entity 7.x-1.0-beta3. I'm going to try the dev version now.

CommentFileSizeAuthor
#9 entity-field_type.patch1.72 KBfago
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mcfilms’s picture

Same error after update although it is on line 20 now. I might add that I am also getting an error when I reload any page now:

Notice: Undefined index: module in _field_info_prepare_instance_widget() (line 385 of /home/everlast/public_html/take5/modules/field/field.info.inc).

and that line reads:

  $widget['module'] = $widget_type['module'];
sun’s picture

Status: Active » Closed (cannot reproduce)

Please make sure that you run on latest versions of both modules/code.

mcfilms’s picture

@sun -- I am running the very latest with this issue:
rules-7.x-2.x-dev.
entity-7.x-1.x-dev
drupal-7.0-rc2

I still get:

Fatal error: Unsupported operand types in /home/everlast/public_html/take5/sites/all/modules/entity/modules/field.info.inc on line 20 

I realize that although my error points at the Entity API, the cause can be any one of a number of external factors. I didn't see any documentation about known incompatibilities.

I have these additional D7 modules:

admin_menu
backup_migrate
ctools
entity
google_analytics
image_resize_filter
imce
imce_wysiwyg
pathauto
preset
rules
superfish
token
video
views
wysiwyg

What would you suggest my next step be? Should I recreate this error on a brand new environment and then share access to it?

sun’s picture

drupal-7.0-rc2

You also need latest Drupal HEAD.

mcfilms’s picture

I can report the exact same experience under Drupal core 7.x-dev from 2010-Dec-17.

This shows up when I visit the modules page:

    Fatal error: Unsupported operand types in /home/everlast/public_html/take5/sites/all/modules/entity/modules/field.info.inc on line 20 

Can we just take a look at line 20 and the operand again?

    $field_type = field_info_field_types($field['type']) + array('property_callbacks' => array());

Should that be a plus sign? I grant that my php skills are puny, but "+" doesn't look right. Maybe I'm just grasping at straws.

wjaspers’s picture

Version: 7.x-1.0-beta3 » 7.x-1.0-beta6
Component: Entity Metadata - main » Core integration
Status: Closed (cannot reproduce) » Active

I can cause it, too.
Fatal error: Unsupported operand types in sites\all\modules\entity\modules\field.info.inc on line 20

It seems to be happening AFTER the node is saved.
I have a feeling this is triggered by upgrading the Token module.

My order of events

  1. Setup Drupal7
  2. Create various content-types
  3. Setup Ubercart for Drupal 7
  4. Add a product class
  5. Update the product class (node type) to have several required fields
  6. save the content type
  7. Create a new node of that content-type
  8. Fill in required fields
  9. Press Save & continue
  10. KABLOOIE: See the fatal error.

I'm willing to bet on #5's explanation, too:
field_info_field_types($field['type']) looks as if it should return a BOOL.
If this is the case, bool + array cannot work.
If it is returning an array array + array claims to be PHP4 and 5 compatible. (see: http://us3.php.net/manual/en/language.operators.array.php ).

I have a strong feeling array + array was an undocumented improvement to early versions of PHP5. It may look wrong, but it is actually a form of array_merge. Nonetheless, this error shouldn't occur, since I'm using the most recent PHP5 version anyway.

wjaspers’s picture

Read up on the field_info_field_types in Core. Looks like if a field type is provided, a STRING is returned; which WILL cause the expression identified to FAIL in PHP.

This can be overcome by putting the output of field_info_field_types into an array with a key that needs to be placed in the other side of the expression; OR ... improving the naming of hooks so they're not as easily misused.

See: CORE/modules/field/field.info.inc @ line 471

/**
 * Returns information about field types from hook_field_info().
 *
 * @param $field_type
 *   (optional) A field type name. If ommitted, all field types will be
 *   returned.
 *
 * @return
 *   Either a field type description, as provided by hook_field_info(), or an
 *   array of all existing field types, keyed by field type name.
 */
function field_info_field_types($field_type = NULL) {
  $info = _field_info_collate_types();
  $field_types = $info['field types'];
  if ($field_type) {
    if (isset($field_types[$field_type])) {
      return $field_types[$field_type];
    }
  }
  else {
    return $field_types;
  }
}
fago’s picture

It returns the field type info array, thus the array+array operand is fine. But maybe the field-type in question is not available any more as the module is deactivated, thus the error is triggered?

fago’s picture

Title: Unsupported operand types » Unsupported operand types if a field type is missing.
Version: 7.x-1.0-beta6 » 7.x-1.x-dev
Status: Active » Needs review
FileSize
1.72 KB

The attached patch should fix it. Please test.

fago’s picture

Status: Needs review » Fixed

At least the additional check won't harm, so I've just committed #9.

Status: Fixed » Closed (fixed)

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