Hi All.

I find some bug in module commerce line item in hook_menu implementation.

So, when user(admin) tries to make clear cache all or only menu cache, The system shows this PDOException:

PDOException: SQLSTATE[21S01]: Insert value list does not match column list: 1136 Column count doesn't match value count at row 15: INSERT INTO {menu_router} (path, load_functions, to_arg_functions, access_callback, access_arguments, page_callback, page_arguments, delivery_callback, fit, number_parts, context, tab_parent, tab_root, title, title_callback, title_arguments, theme_callback, theme_arguments, type, description, position, weight, include_file) VALUES (:db_insert_placeholder_0, .......

Because in module commerce_line_item in function commerce_line_item_ui_menu (hook_menu implementation) function commerce_line_item_types() return array in 'name' key. But should returrn string for title field.

Example:
File commerce_line_item_ui.module line 27.

 foreach (commerce_line_item_types() as $type => $line_item_type) {
    // Convert underscores to hyphens for the menu item argument.
    $type_arg = strtr($type, '_', '-');

    $items['admin/commerce/config/line-items/' . $type_arg] = array(
      'title' => $line_item_type['name'], // <--- THIS IS ARRAY BUT SHOULD BE A STRING.
      'page callback' => 'commerce_line_item_ui_line_item_type_redirect',
      'page arguments' => array($type_arg),
      'access arguments' => array('administer line item types'),
    );
  }

Thx in advance

CommentFileSizeAuthor
menu-PDOException-fix.patch897 bytesksemihin

Comments

rszrama’s picture

Version: 7.x-1.8 » 7.x-1.x-dev
Category: Bug report » Support request
Status: Active » Closed (won't fix)
Issue tags: -PDOException

Whatever module you're working with that has an array for the line item type name is in error here. It's documented that 'name' should be a translatable string, so you'll need to find what module is not doing that and patch it there.

capellic’s picture

I ran into this same error and same problem:

Notice: Array to string conversion in commerce_line_item_types() (line 442 of /mnt/www/html/cgcdqjjgym69r/docroot/sites/all/modules/contrib/commerce/modules/line_item/commerce_line_item.module). Backtrace:commerce_line_item_types() commerce_line_item.module:487

Turned out that I had created a line item through the interface prior to enabling a module that had a product line item with the same machine name. To resolve I deleted the product line item I had created through the interface.