When saving a node with a matrix field, I get the following error:

Fatal error: Cannot use string offset as an array in sites/all/modules/matrix/matrix.module on line 306

This is in the hook_field function, and it seems like the $items array, which is coming in as a flat array, is expected to be a multidimensional. It doesn't matter what I put in the matrix field, the result is always the fatal error.

Here's the field definition for my matrix field:

array (
  'field_name' => 'field_rental_pricing',
  'type_name' => 'listing',
  'display_settings' => 
  array (
    'label' => 
    array (
      'format' => 'above',
      'exclude' => 0,
    ),
    'teaser' => 
    array (
      'format' => 'default',
      'exclude' => 0,
    ),
    'full' => 
    array (
      'format' => 'default',
      'exclude' => 0,
    ),
    4 => 
    array (
      'format' => 'default',
      'exclude' => 0,
    ),
    2 => 
    array (
      'format' => 'default',
      'exclude' => 0,
    ),
    3 => 
    array (
      'format' => 'default',
      'exclude' => 0,
    ),
    'token' => 
    array (
      'format' => 'default',
      'exclude' => 0,
    ),
  ),
  'widget_active' => '1',
  'type' => 'matrix',
  'required' => '0',
  'multiple' => '0',
  'db_storage' => '1',
  'module' => 'matrix',
  'active' => '1',
  'locked' => '0',
  'columns' => 
  array (
  ),
  'mode' => 'cols',
  'empty' => '-',
  'empty_hide' => 0,
  'rows_elements' => 'a:4:{i:0;a:6:{s:5:"#type";s:5:"title";s:6:"#title";s:6:"Spring";s:8:"#options";N;s:5:"#size";s:0:"";s:9:"#required";i:0;s:12:"#calc_method";s:9:"undefined";}i:1;a:6:{s:5:"#type";s:5:"title";s:6:"#title";s:6:"Summer";s:8:"#options";N;s:5:"#size";s:0:"";s:9:"#required";i:0;s:12:"#calc_method";s:9:"undefined";}i:2;a:6:{s:5:"#type";s:5:"title";s:6:"#title";s:4:"Fall";s:8:"#options";N;s:5:"#size";s:0:"";s:9:"#required";i:0;s:12:"#calc_method";s:9:"undefined";}i:3;a:6:{s:5:"#type";s:5:"title";s:6:"#title";s:6:"Winter";s:8:"#options";N;s:5:"#size";s:0:"";s:9:"#required";i:0;s:12:"#calc_method";s:9:"undefined";}}',
  'cols_elements' => 'a:3:{i:0;a:6:{s:5:"#type";s:9:"textfield";s:6:"#title";s:5:"Daily";s:8:"#options";N;s:5:"#size";s:0:"";s:9:"#required";i:0;s:12:"#calc_method";s:9:"undefined";}i:1;a:6:{s:5:"#type";s:9:"textfield";s:6:"#title";s:6:"Weekly";s:8:"#options";N;s:5:"#size";s:0:"";s:9:"#required";i:0;s:12:"#calc_method";s:9:"undefined";}i:2;a:6:{s:5:"#type";s:9:"textfield";s:6:"#title";s:7:"Monthly";s:8:"#options";N;s:5:"#size";s:0:"";s:9:"#required";i:0;s:12:"#calc_method";s:9:"undefined";}}',
  'widget' => 
  array (
    'default_value' => 
    array (
      0 => 
      array (
        0 => 
        array (
          0 => '',
          1 => '',
          2 => '',
        ),
        1 => 
        array (
          0 => '',
          1 => '',
          2 => '',
        ),
        2 => 
        array (
          0 => '',
          1 => '',
          2 => '',
        ),
        3 => 
        array (
          0 => '',
          1 => '',
          2 => '',
        ),
        4 => 
        array (
          0 => '',
          1 => '',
          2 => '',
        ),
      ),
    ),
    'default_value_php' => NULL,
    'label' => 'Rental Pricing',
    'weight' => '1',
    'description' => 'Enter the pricing for your rental property.  You can define different pricing based on the season.',
    'type' => 'matrix',
    'module' => 'matrix',
  ),
)

Comments

duellj’s picture

More Info:

This error only happens when editing nodes that were created before the matrix field was added to the content type.

intrafusion’s picture

Status: Active » Closed (won't fix)