A query is giving me the error message "Fatal error: Unsupported operand types in /etc/drupal/6/sites/all/modules/views/plugins/views_plugin_query_default.inc on line 696" when I try to "preview" the results.

The 696 line corresponds to:
// Create a field info array.
$field_info = array(
'field' => $field,
'table' => $table,
'alias' => $alias,
) + $params;

This query used to work with views 2. Should I downgrade or is there a fix for this?

Comments

dawehner’s picture

Status: Active » Postponed (maintainer needs more info)

Can you please provide a way to reproduce the problem?

Before you make any module update please make a backup to be able to revert to the previous state.

ayukko’s picture

Sure!

So this is the "fact chronology": I installed the Leaguesite module which provides a query. I tested it with views version 6.2.11 and worked just fine. Later on, I updated views to 6.x-3.x-dev. I have just tried the view again in order to modify it and then I got the error in the title.

After posting this issue, I tried to create a new view from scratch. I added the sort criteria and the filters just fine but then I added a "Global view result counter" field, saved the view and got the error message again (not getting it after saving for sort criteria and filters). Removed the field, added node:title and still getting it.

Is there anything I can provide you with to help you figuring out what is going on? In that case, just let me know. I am a newbie so I will need detailed instructions in case you need something else than a view export (using the export button on the views UI)

dawehner’s picture

Project: Views (for Drupal 7) » LeagueSite
Version: 6.x-3.x-dev » 6.x-1.x-dev

Move to leaguesite.
if it's really a bug in views this issue can be moved back.

ayukko’s picture

Excuse my ignorance, what do you mean by "Move to leaguesite" and "move back"?

dawehner’s picture

Set the project of this issue to leaguesite :)

If someone can say that the bug is in views code and not something specific to leaguesite, it can be moved back to views.

ayukko’s picture

lol! thanks for the explanation. I have to learn how to "read" this post tool as well, I can see now the field project is "Leaguesite"

ayukko’s picture

Status: Postponed (maintainer needs more info) » Active

Hi there! just a friendly reminder this bug is still bitting.... thanks!

ddorian’s picture

we all like the new features of views3 but many modules are not compatible and it is still alpha so.... downgrade?

Alun’s picture

I'm with ddorian on this, I haven't tested any of the module with Views 3, so it might be best to stick with Views 2 for the moment.
Alun

dawehner’s picture

Just from my perspective this should be a bug in views2 integration, too.

There aren't any api changes which might can cause this behavior.

ayukko’s picture

Further news on this one... It bit me up again when building my view from scratch using latest dev version (17/02/2011). I added the field LeagueSite Standings: Points in the sorting section of the view and then got the error message. I had already added this field in the fields section and it worked fine.

Any ideas?

MasterChief’s picture

Hi ayukko!

Could you make an export of the view and give it here ?

I will try to see the problem if you do it.

Alun’s picture

This is not a problem with the construction of the view using the UI, I think this is a problem with a custom view handler I created for the points column.
The offending line I imagine is line 17 of leaguesite_handler_sort_points.inc in leaguesite_league/views/

$this->query->add_orderby(NULL, '((leaguesite_standings.won_home + leaguesite_standings.won_away) * leaguesite_sports.win) + ((leaguesite_standings.lost_home + leaguesite_standings.lost_away) * leaguesite_sports.loss) + ((leaguesite_standings.drawn_home + leaguesite_standings.drawn_away) * leaguesite_sports.draw) + (leaguesite_standings.bonus_home + leaguesite_standings.bonus_away)', $this->options['order'], 'leaguesite_standings_points_sort');

Quite which operand is unsupported I don't know. I'm not sure what I need to change here. I'll have to have a look at it.
Alun

ayukko’s picture

Hi there!

I have used the following work around which I found browsing drupal site and it works:

The piece of code biting in the /etc/drupal/6/sites/all/modules/views/plugins/views_plugin_query_default.inc on line 696" was

// Create a field info array.
$field_info = array(
'field' => $field,
'table' => $table,
'alias' => $alias,
) + $params;

I have updated the last line to ) + (array)$params; and it works fine now.

I have no idea why this works though, I am not a savvy php programer.

Let me know if you need something else I can help with.

ddorian’s picture

ayukko the idea is that the problem is with leaguesite so you need to change leaguesite and not views

MasterChief’s picture

I am using the latest version of views 6.x-3.dev and i have this error on league_standings :

Fatal error: Unsupported operand types in C:\wamp\www\fts\mysite\all\modules\views\plugins\views_plugin_query_default.inc on line 702

MasterChief’s picture

Ok i understand the problem,

Alun why don't you add a column "Points" in the table leaguesite_standings ?

The comment in #13 is the problem for me too, you can make a sort only on a data, if you make an operation each row the sql request will be very long and even i don't think it will work.

Alun’s picture

Hi Masterchief,
adding points would be a pointless exercise, since points is derived from data that already exists in the database. It would cause data duplication, which would make adding and subtracting points (in the result of matches being edited and deleted) more difficult.
The issue goes on. I haven't installed Views 3 but when I do, I can assess this problem. At least we know whats causing it.
Alun