Download & Extend

Moderation History link in views causes errors after updating from Views 7.x-3.0-rc1 to 7.x-3.0-rc3

Project:Workbench Moderation
Version:7.x-1.x-dev
Component:Code
Category:bug report
Priority:major
Assigned:Unassigned
Status:postponed (maintainer needs more info)

Issue Summary

After updating Views from 7.x-3.0-rc1 to 7.x-3.0-rc3, the following errors appear in my views that have the "Workbench Moderation: Moderation History Link" field.

Error message

Warning: array_flip(): Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() (line 178 of /var/www/drupal-7.9/includes/entity.inc).

Warning: array_flip(): Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->cacheGet() (line 354 of /var/www/drupal-7.9/includes/entity.inc).

Recoverable fatal error: Object of class stdClass could not be converted to string in DatabaseStatementBase->execute() (line 2135 of /var/www/drupal-7.9/includes/database/database.inc).

The errors disappear when I remove the field, and re-appear when I add it again. The view doesn't come up at all.

Comments

#1

Title:Moderation History link in views causes errors after updating to the latest version of the Entity module» Moderation History link in views causes errors after updating from Views 7.x-3.0-rc1 to 7.x-3.0-rc3

#2

Status:active» closed (works as designed)

It appears that the issue was related to location content on my sites. Still need to investigate the root cause, but if there are any problems with Workbench Moderation I will make another ticket with more detaiils.

#3

Status:closed (works as designed)» active

The issue appeared again, so I set up a site from scratch and was able to reproduce it outside of my install profile.

Steps to reproduce:
1. Install a Drupal 7.9 site with the Standard profile
2. Download and enable the latest (non-dev) views, ctools, workbench and workbench moderation
3. Turn on moderation for the Basic Page content type
4. Make a view, table style
5. Try to add the Moderation History link field
6. You receive this error:

An AJAX HTTP error occurred.
HTTP Result Code: 500
Debugging information follows.
Path: /admin/structure/views/view/test_view/preview/page/ajax
StatusText: Service unavailable (with message)
ResponseText: Recoverable fatal error: Object of class stdClass could not be converted to string in DatabaseStatementBase->execute() (line 2137 of /var/www/drupal-7.9/includes/database/database.inc).

#4

Version:7.x-1.1» 7.x-1.x-dev

I was not able to reproduce your error. In my testing the history link is simply broken and not rendering a link. I'm not seeing an error message.

I suspect this Views change is the reason: #1172970: provide a unified way to retrieve result entities

#5

Priority:normal» major

I was able to reproduce the error when building a View with {node} as the base table. I made my previous comment testing with {node_revision} as the base table.

#6

This issue also is in play here: #1270890: provide a way to provide entity-related views fields

I tried this but it didn't change the error.

AttachmentSizeStatusTest resultOperations
views_link-1350996.patch714 bytesIdlePASSED: [[SimpleTest]]: [MySQL] 137 pass(es).View details | Re-test

#7

Status:active» needs review

The issue is with the render_link function in workbench_moderation_handler_field_history_link.inc --

The latest version of Views has changed how the render_link function works (see views_handler_field_node_link_edit.inc for the latest example), no longer using $this->get_value($values, 'nid') to get a node ID. Instead, the node gets passed directly, replacing the $data argument.

Note that the changes in this patch will work for views RC3 or higher, but will give an error message when used with an older version of views.

AttachmentSizeStatusTest resultOperations
views_history_link-1350996.patch718 bytesIdlePASSED: [[SimpleTest]]: [MySQL] 137 pass(es).View details | Re-test

#8

Status:needs review» needs work

The patch in #7 does not change the end behavior I'm seeing. In my testing, the render() function is not being reached.

cwc, can you confirm this is working for you?

#9

I can confirm that this is working for me. I went through the steps in #3 to reproduce the errors, and applying the patch fixed them.

The patch is changing code within the render_link() function. If the function isn't even being reached, would that be a different issue?

#10

Here is the exported view I was using for testing:

$view = new view;
$view->name = 'test';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'test';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['title'] = 'test';
$handler->display->display_options['access']['type'] = 'perm';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['query']['options']['query_comment'] = FALSE;
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['pager']['options']['items_per_page'] = '10';
$handler->display->display_options['style_plugin'] = 'table';
/* Field: Content: Title */
$handler->display->display_options['fields']['title']['id'] = 'title';
$handler->display->display_options['fields']['title']['table'] = 'node';
$handler->display->display_options['fields']['title']['field'] = 'title';
$handler->display->display_options['fields']['title']['label'] = '';
$handler->display->display_options['fields']['title']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['title']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['title']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = 0;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = 0;
$handler->display->display_options['fields']['title']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['title']['alter']['trim'] = 0;
$handler->display->display_options['fields']['title']['alter']['html'] = 0;
$handler->display->display_options['fields']['title']['hide_empty'] = 0;
$handler->display->display_options['fields']['title']['empty_zero'] = 0;
$handler->display->display_options['fields']['title']['link_to_node'] = 1;
/* Field: Workbench Moderation: Moderation History Link */
$handler->display->display_options['fields']['workbench_moderation_history_link']['id'] = 'workbench_moderation_history_link';
$handler->display->display_options['fields']['workbench_moderation_history_link']['table'] = 'node';
$handler->display->display_options['fields']['workbench_moderation_history_link']['field'] = 'workbench_moderation_history_link';
$handler->display->display_options['fields']['workbench_moderation_history_link']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['workbench_moderation_history_link']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['workbench_moderation_history_link']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['workbench_moderation_history_link']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['workbench_moderation_history_link']['alter']['trim_whitespace'] = 0;
$handler->display->display_options['fields']['workbench_moderation_history_link']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['workbench_moderation_history_link']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['workbench_moderation_history_link']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['workbench_moderation_history_link']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['workbench_moderation_history_link']['alter']['trim'] = 0;
$handler->display->display_options['fields']['workbench_moderation_history_link']['alter']['html'] = 0;
$handler->display->display_options['fields']['workbench_moderation_history_link']['element_label_colon'] = 1;
$handler->display->display_options['fields']['workbench_moderation_history_link']['element_default_classes'] = 1;
$handler->display->display_options['fields']['workbench_moderation_history_link']['hide_empty'] = 0;
$handler->display->display_options['fields']['workbench_moderation_history_link']['empty_zero'] = 0;
$handler->display->display_options['fields']['workbench_moderation_history_link']['hide_alter_empty'] = 1;
$handler->display->display_options['fields']['workbench_moderation_history_link']['text'] = 'link';
/* Sort criterion: Content: Post date */
$handler->display->display_options['sorts']['created']['id'] = 'created';
$handler->display->display_options['sorts']['created']['table'] = 'node';
$handler->display->display_options['sorts']['created']['field'] = 'created';
$handler->display->display_options['sorts']['created']['order'] = 'DESC';
/* Filter criterion: Content: Published */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'node';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = 1;
$handler->display->display_options['filters']['status']['group'] = 0;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
/* Filter criterion: Content: Type */
$handler->display->display_options['filters']['type']['id'] = 'type';
$handler->display->display_options['filters']['type']['table'] = 'node';
$handler->display->display_options['filters']['type']['field'] = 'type';
$handler->display->display_options['filters']['type']['value'] = array(
  'page' => 'page',
);

/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page');
$handler->display->display_options['path'] = 'test';

#11

The patch in #7 worked for me.

#12

Upgraded views to 3.1 and the link no longer appears.. no error though!

#13

We are post views 3.5. is this still an issue?

#14

Status:needs work» postponed (maintainer needs more info)