I am getting a fatal error after installing Drupal Commerce:

Drush command terminated abnormally due to an unrecoverable error.
Error: Unsupported operand types in .../sites/all/modules/contrib/entity/views/entity.views.inc, line 189

I'm not able to run xdebug where I'm encountering the error, but with var_dump I've narrowed it down to entity_views_field_definition in entity.views.inc. It's a helper function used to generate data for hook_views data(). (Function definition is: entity_views_field_definition($field, array $property_info, array &$table, $title_prefix = '') .)

The function is passed NULL for $property_info and blows up on line 189, which assumes an array. I assume this is bad data coming from commerce install, but haven't been able to nail it down yet.

It seems to have been an issue with Commerce for a while:
#1480106: "unexpected error" crash site when activate order
#1361562: Re-enabling Commerce causes a PHP Fatal Error

While I haven't found the source, I have been able to fix it by adding a check to the beginning of entity_views_field_definition() and returning if the property_info is not set. I know the helper functions assume data is good, but a little data check doesn't hurt.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

cleaver’s picture

cleaver’s picture

Sylvain Lecoy’s picture

cleaver’s picture

cleaver’s picture

Just realized also... when I rolled my patch in #2, I did it from the root of my project, not from the module. So, it won't apply with drush make. Just a one-liner, but I may reroll if the related patch doesn't work for me.

cleaver’s picture

Status: Active » Closed (duplicate)

The patch in the related issue fixes this problem.

See: #2122389: Views handler not working properly throwing warnings at cache flushing...

Sylvain Lecoy’s picture

Do not hesitate to put the issue as RTBC (Reviewed and Tested By the Community). This will help commit this patch rapidly.

Cheers!

cleaver’s picture

Status: Closed (duplicate) » Active

I still seem to be able to get the error, even with patch from #2122389: Views handler not working properly throwing warnings at cache flushing.... It is not a regular problem, but happened when I moved a database from one server to another.

joelpittet’s picture

#2 solves the error for me. It would be good to know maybe what is sending in an empty $property_info to begin with?

eric.chenchao’s picture

Version: 7.x-1.2 » 7.x-1.3

It also happens in the newer version.

eric.chenchao’s picture

Have updated patch path from a/sites/all/modules/contrib/entity to a.

jwjoshuawalker’s picture

Version: 7.x-1.3 » 7.x-1.5
Status: Active » Needs review

Still happens.

I don't know the full extent of how/why etc but this is all I did:
Had site A and site B as a duplicate copy.
Using drush sql-sync to copy DB from A to B periodically.
Everything was fine until commerce was installed, then this error.

Patch in #11 makes the site usable again.

The last submitted patch, 2: unsupported-operands-2136919-2.patch, failed testing.

Pls’s picture

Patch from #11 works great.

jruadh’s picture

After cloning my site from my server to my local drive, the patch from #11 worked. Followed by clearing all caches.

Pls’s picture

Status: Needs review » Reviewed & tested by the community
SocialNicheGuru’s picture

Edit: sorry, this was meant for another post. My apologies for the clutter. And yes it seems to work for me too

this is already included in the latest dev version

joelpittet’s picture

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

@SocialNicheGuru #11 is not included in the latest dev. The patch just applied cleanly against the latest git repo.

Still RTBC.

fago’s picture

Title: Unsupported operand types in entity.views.inc » Unsupported operand types in entity.views.inc when property info is missing.
Status: Reviewed & tested by the community » Postponed (maintainer needs more info)

This should not happen, it's probably caused by some cache rebuilding issue.

Is everything working correctly after #11 being applied? I'm a bit hesitant to just ignore this is this might be important to show that something is wrong. I.e. we could even throw an exception instead?

mgifford’s picture

It is a totally simple patch. However, I'm having trouble replicating the problem on a fresh install. If Drupal Commerce is installed with Drush does it always provide this error?

I'd like to be able to reproduce this error to see that this isn't just a cache issue.

crimsondryad’s picture

I'm seeing this too, it popped for me while enabling the google charts module. And also in other stuff related to commerce, it looks like maybe commerce_order. I haven't had a chance to try to dig in further, obviously this isn't a clean install.

Patch prevented the error for me. How would we go about finding out if there is a deeper issue?

Louis Delacretaz’s picture

I was having the same fatal error at flag/includes/flag/flag_flag.inc on line 132, fixed it by rolling back the database
and started getting this error at entity/views/entity.views.inc on line 189.

Manually clearing the cache table fixed the error for me.

I had been setting up memcached on the server which could be the cause of corrupted cache table.

Hope that helps in the digging for a root cause.