Not sure if should be posted here or in entity, but Installing order and order Ui throw these fatal errors:

Recoverable fatal error: Argument 2 passed to entity_views_field_definition() must be an array, null given, called in /home/zzz/sites/all/modules/entity/views/entity.views.inc on line 140 and defined in entity_views_field_definition() (line 162 of /home/zzzzzz/sites/all/modules/entity/views/entity.views.inc).

Fatal error: Unsupported operand types in /home/zzzzzzzz/sites/all/modules/entity/entity_token.tokens.inc on line 93

Commerce: 7.x-1.2
Entity 7.x-1.x-dev from 02/06 and 02/07
Drupal: 7.12

Comments

any help? suggestions?

Updated to Commerce dev, getting same error: Recoverable fatal error: Argument 2 passed to entity_views_field_definition() must be an array, null given, called in /home/zzzzzz/sites/all/modules/entity/views/entity.views.inc on line 140 and defined in entity_views_field_definition() (line 162 of /home/zzzzzz/sites/all/modules/entity/views/entity.views.inc).

I was ready to buy the Linda.com course, but now I am stuck with this error.

Priority:Critical» Normal

I've never seen this error before, and I have no clue what that function in the Entity module is doing. This doesn't happen on normal installs of Drupal Commerce; what version of the Entity API module are you using?

Status:Active» Postponed (maintainer needs more info)

Priority:Normal» Critical

Same error here.
My site is out !

Priority:Critical» Normal

We still need more information before we can debug this, so can you offer up any more details so we can diagnose what's causing the error?

Sorry, no more information than devonw gave.
This happened when I have clicked on 'Save' button in admin modules page.

Title:Recoverable fatal error: Argument 2 passed to entity_views_field_definition() must be an arrayFatal error order component

Commerce is not calling entity_views_field_definition() anywhere. So this is not directly a Commerce error.

Still, doesn't mean we can't debug it.
Open entity/views/entity.views.inc, find "function entity_views_field_definition" and replace the following code:

<?php
function entity_views_field_definition($field, array $property_info, array &$table, $title_prefix = '') {
 
$additional = array();
 
$additional_field = array();
?>

with this code:
<?php
function entity_views_field_definition($field, $property_info, array &$table, $title_prefix = '') {
 
$additional = array();
 
$additional_field = array();
  if (!
is_array($property_info)) {
   
$backtrace = debug_backtrace();
   
dsm($backtrace);
    return;
  }
?>

See what that tells you (either provide the full output or access to a page where that is output).
Note that for dsm() to work you need the Devel module. You can replace that with a var_dump() if you don't have Devel, but it won't be very readable.

Title:Fatal error order componentRecoverable fatal error: Argument 2 passed to entity_views_field_definition() must be an array

Retitling for better visibility.

Also, please provide your Entity API version. I'm assuming you're using a newer one than the one that Commerce recommends.

Title:Fatal error order componentRecoverable fatal error: Argument 2 passed to entity_views_field_definition() must be an array

I was getting a series of errors that lead me to this thread and a few others. My problem was the price field was missing from the product type. I added it as field_price figuring I had to add it manually for some reason. I ended up removing the price field and used commerce_repair module which added the correct commerce_price field and seems to have cleared up the issue.

I'm using Entity API 7.x-1.0-rc3.

Status:Postponed (maintainer needs more info)» Fixed

Yeah, it has to have a specific name, commerce_price, not the name that would be given through the UI, field_price. That's why Commerce Repair fixed it - it has the ability to set the right name. For now all I can assume is that this would also solve the above issues, so I'm going to mark this fixed.

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Status:Closed (fixed)» Active

The bug still exist in the current DC version!

The solution to fix this bug is not a fix in the Entity module.
The solution is to fix the DC module code. Please take a look at this forum topic: http://www.drupalcommerce.org/comment/4307#comment-4307

Status:Active» Closed (fixed)

What you've posted is a non-solution for reasons I've laid out there. I don't even know if we should be fixing this here, as it's just going to disguise a problem, but I've edited the .info.inc so it checks to ensure there's a commerce_price field in that $properties array before trying to assign it to the product's property info array.

The solution is still to repair the site so the product types have the required default commerce_price field.

Status:Closed (fixed)» Active

After clearing cache I got.

Catchable fatal error: Argument 2 passed to entity_views_field_definition() must be an array, null given, called in /var/www/vhosts/test/sites/all/modules/entity/views/entity.views.inc on line 152 and defined in /var/www/vhosts/test/sites/all/modules/entity/views/entity.views.inc on line 175

The $property "commerce_order_total" is NULL.

Can't run commerce_repair because of WSOD.

How to repair if I can't run commerce_repair? And nothing at all, even drush.

Status:Active» Closed (fixed)

I'd post a support request or search the issue queue of the Commerce Repair module itself. The real question would be how did you end up with an installation that did not get the proper Order Total price field?

Everything was working OK before clearing cache. How can I manually add that field to DB?

There's no way to create fields directly through the database, but clearing the cache also shouldn't be removing any fields. Not sure why that suddenly caused a problem to present itself.

I've found a possible work-around for this problem that you cannot enable commerce_order.

http://drupal.org/node/1748382

Short answer seems to be:

1) Enable commerce_order and commerce_order_ui: your site will break.
2) Edit the site database, system table, and set the status to zero for these two modules.
3) Re-enable the two modules.

This problem exists in my new install of Drupal7.
Here is my info.

Centos 6
mysql 5.1.61
php 5.3.3
Drupal 7.15 from the fedora RHEL extras rpm
commerce 7.x-1.3

Drupal modules are
CTools 7.x-1.2
Entity API 7.x-1.0-rc3
Views 7.x-3.5
Rules 7.x-2.2
Address field 7.x-1.0-beta3

Its a clean install, no content and nothing altered.

Everything works fine until the "Order" module is activated. This took a bit a tracking I can tell you since the error doesn't appear every time.

I'll clarify that.
The error always begins after the "Order" module is activated.
The error does not appear every page change.
You can get the error to go away for a while by clearing the cash but next time you try to access something in the orders it will come back.
The error kills parts of drupal even if the cache gets cleared. For instance the main part of "Configuration" is dead but other parts might work.

I get these two errors some of the time. I always get the second one, the first one sometimes isn't there. I think the first error is the key here.

Notice: Undefined index: commerce_order_total in commerce_order_entity_property_info_alter() (line 133 of /etc/drupal7/all/modules/contrib/commerce/modules/order/commerce_order.info.inc).

Recoverable fatal error: Argument 2 passed to entity_views_field_definition() must be an array, null given, called in /usr/share/drupal7/modules/entity/views/entity.views.inc on line 152 and defined in entity_views_field_definition() (line 175 of /usr/share/drupal7/modules/entity/views/entity.views.inc).

I'm new to Drupal and a bit green with PHP but I am an experienced C programmer and I do know what I'm reading in PHP even if I am slow. I also know how to deal with SQL as long as the queries don't get too complex :-)

So is "commerce_order_total supposed to appear in a database table somewhere?
On my system it is nowhere in the database except in the cache when the error starts occurring.

.......

OK, so I'm doing tests and trying to debug this as I'm typing this note.

I've just done as Fonant suggested but I only disabled "Order" in the "system" table of the database and then re-enabled it via Drupal->modules.

Now there are entries for "commerce_order_total" in the "field_config" and "field_config_instance" tables of my database and everything seems to be working as it should.

I'm starting to think this may be a dependency issue at install time.

One other piece of information that may have an effect.
The original install was not done as "user/1" it was done as "user/2" who has administrator privileges.
The re-install or the "Order" module was done as "user/1".

Thank you very much davew1970,
your note on installing the modules with user 1 instead of other one with administration privileges helped me with a solution for my site with this problem that has been puzzling me for two days!
thanks again, I hope it helps somebody!

Just tried to install the order module with commerce 1.4

The trick of enabling, then editing the system table, then re-enabling does not work. Instead I get this error when enabling:
FieldException: Attempt to create an instance of field commerce_line_items on bundle commerce_order that already has an instance of that field. in field_create_instance() (line 490 of /srv/bindings/1eb349c807a249dcaf8c532aa0ecc7b6/code/modules/field/field.crud.inc).

If I disable the module via the database, then try to run commerce_repair it doesnt recognize the order module is enabled and doesn't fix it....then if I clear the cache I get the same set of errors

If I uninstall the order module the re-enable it the same error being reported in this issue continues:
immediately reported by the url /admin/modules/list/confirm:

Recoverable fatal error: Argument 2 passed to entity_views_field_definition() must be an array, null given, called in /usr/share/drupal7/modules/entity/views/entity.views.inc on line 152 and defined in entity_views_field_definition() (line 175 of /usr/share/drupal7/modules/entity/views/entity.views.inc).

Throughout the site:
Fatal error: Unsupported operand types in /srv/bindings/1eb349c807a249dcaf8c532aa0ecc7b6/code/profiles/openenterprise/modules/entity/entity_token.tokens.inc on line 93

Can't install commerce : (

I've tried completly uninstalling commerce and then trying to start fresh with versions as far back as 1.1....no luck....version 1.1 of order same behavior when enabling

I turned on notices and this notice proceeds the entity_views_field_definition error

Notice: Undefined index: commerce_order_total in commerce_order_entity_property_info_alter() (line 133 of /srv/bindings/1eb349c807a249dcaf8c532aa0ecc7b6/code/sites/all/modules/commerce/modules/order/commerce_order.info.inc).

same thing as comment #22 ...
commerce kickstart is ok but a new install with drupal 7.17
kicks my install's butt right at order's module install...

Priority:Normal» Major
Status:Closed (fixed)» Active

I'm running into this too. All I'm doing is trying to enable Drupal Commerce in a new installation, one module at a time, as suggested in the documentation. Everything is fine until you try to enable the order module, then you get one or another of the above fatal errors and can go no further. I've tried enabling one module at a time, uninstalling and reinstalling, enabling everything at once. At whatever point you try to enable the Order module it blows up.

This is pretty major, since you can't even get started.

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

And this is with 1.4 on a clean Drupal install.

Category:support» bug

And this is a bug report.

@KarenS Are you missing the Order Total price field on your order definition perhaps? Check the field list and see if there's one called commerce_order_total. That was the only lead discovered above in comment #9.

I haven't defined anything, I'm just trying to install it. Where would there be an order definition if I haven't even installed it?

KarenS, I fixed it using commerce repair previous to installing the order module.

After lots of installing/uninstalling, removing tables manually from the db, etc., I finally got it installed. But it generated tons of errors on every step from the time I enabled the Order module on. Something is definitely wrong in the clean installation process.

I'll try it again; I typically just install everything at once, to be honest, so I was unaware we had documentation advising single module installation. Still, it shouldn't cause any issues. My question wasn't about you defining anything manually but about a field the module is supposed to create upon installation. This has been the biggest pain point for Commerce - fields that should be created on module installation for some reason don't. And we've never been able to nail down why.

So, when you installed the Order module, a Commerce Price field named commerce_order_total should have been created automatically for you. If it's missing, then it causes side effects related to the Entity API / Views that you're seeing as fatal errors. You said this was a pre-existing Drupal site - any chance you can think of any module on there that may have prevented a field from being created on hook_enable()?

And if you look in the field list at admin/reports/fields (or at the field tables in the database), is there a commerce_order_total field?

I tried it again from a completely clean installation, and this time I got things installed without errors. The previous time I installed OG first, then tried to install Drupal Commerce, so it wasn't squeaky clean, but it was still new. That means this is going to be hard to reproduce reliably, but there is a genuine problem somewhere :(

And the field creation seemed to be the problem, but not that the field wasn't created but that it tried to create it more than once. The main error I saw was that it was trying to create a field that already existed.

So here's a thought -- if anything interrupts the installation process before the order installation completes, it may have created the field already but not completed the installation. Then when it tries again, the field is already there and you get a fatal error. Maybe the fix is as simple as adding a check before the field is created to see if it already exists.

OK, you are adding the field in hook_enable() and hook_enable() can run lots of times. I see the following code that is intended to check if the field exists yet:

<?php
 
// If a field type we know should exist isn't found, clear the Field cache.
 
if (!field_info_field_types('commerce_line_item_reference') ||
    !
field_info_field_types('commerce_customer_profile_reference')) {
   
field_cache_clear();
  }
 
// Look for or add a line item reference field to the order type.
 
$field_name = 'commerce_line_items';
 
$field = field_info_field($field_name);
 
$instance = field_info_instance('commerce_order', $field_name, $type);
?>

If you don't clear the field cache it is possible you have a field that was just created but is not yet showing up in field_info_field(), then it will proceed to try to create it again. I would change this code to always clear the field cache and see if that helps. I can't think of any reason why you would not always clear the field cache at this point, not sure why the code was written this way. Clearly there are times when this trap isn't working right.

Ahh, ok, in this case it may be related to: #1361562: Re-enabling Commerce causes a PHP Fatal Error (or at least the solution to one will be the solution to the other)

While enabling v7.x-1.4 of the Commerce module these errors led me to this page:

Notice: Undefined index: bundles in commerce_order_entity_property_info_alter() (line 128 of /home/fillmore/public_html/dev/sites/all/modules/commerce/modules/order/commerce_order.info.inc).
Warning: Invalid argument supplied for foreach() in commerce_order_entity_property_info_alter() (line 128 of /home/fillmore/public_html/dev/sites/all/modules/commerce/modules/order/commerce_order.info.inc).
Notice: Undefined index: commerce_line_items in commerce_order_entity_property_info_alter() (line 133 of /home/fillmore/public_html/dev/sites/all/modules/commerce/modules/order/commerce_order.info.inc).
Notice: Undefined index: commerce_order_total in commerce_order_entity_property_info_alter() (line 134 of /home/fillmore/public_html/dev/sites/all/modules/commerce/modules/order/commerce_order.info.inc).
Recoverable fatal error: Argument 2 passed to entity_views_field_definition() must be an array, null given, called in /home/fillmore/public_html/dev/sites/all/modules/entity/views/entity.views.inc on line 152 and defined in entity_views_field_definition() (line 175 of /home/fillmore/public_html/dev/sites/all/modules/entity/views/entity.views.inc).

The error (in bold) has me dead in the water. I tried some of the suggestions above like changing the module status in the database and using the repair module; but neither of these solutions worked because I can't re-enable or enable any module, because when I do, I keep getting the fatal error listed above.

Can anyone offer a solution for just getting my site back up and running? I'm afraid even if I drop all the commerce table from by database, I'm still going to get this error.

@Ryan,
Have you had a chance to submit a fix for this in the dev version? Should I use the dev version when I figure out how to get my site back up and running?

Saddest part for me is I basically had what I needed all working using Ubercart but decided to uninstall it and switch to Commerce when I saw all the great ways commerce integrates with other modules and the drupal 7 ways of doing things. Unlike the first commenter in this thread who said

I was ready to buy the Linda.com course, but now I am stuck with this error.

I actually bought the lynda.com com course, watched it, and decided to switch to commerce.

Thank you,
Scott

Well, now i'm in an even worse situation.

Because the problem seemed to have something to do with entities, I tried setting the "status" of "entity" related modules to 0 in my database to disable them. After doing this to "entity" "entity tolken" "entity reference" and "file entity" it no affect on the error.

I though maybe it had something to do with the "views" module so i set the "status" of all "views" related modules to 0 in my database. After doing this to "EVA" "views" "views node field" "views slideshow" "views slideshow cycle" "views UI" and "date views" I received the even worse fatal error "Fatal error: Call to undefined function entity_load_multiple_by_name() in /home/fillmore/public_html/dev/sites/all/modules/rules/rules.module on line 669"

So to fix this problem, I though I would set the "status" of the "rules" module to 0 in my database. It had no affect.

Now, even when i set the "status" of all the modules back to 1 in the database, I get the same error "Fatal error: Call to undefined function entity_load_multiple_by_name() in /home/fillmore/public_html/dev/sites/all/modules/rules/rules.module on line 669"

Anyone have any suggestions as how I can fix this?
Thank you very much,
Scott

EDIT: Found a solution for this! Drupal 7 caches the "status" of modules so even tho i turned them off in the database, drupal still thought they were enabled. To clear this cache, even when the site has a "white screen of death" and you are unable to use the clear all caches button, follow the method for clearing the cache here http://drupal.org/node/157632

After doing this, I enabled and used the "Commerce Repair" module and that seemed to solve my previous problem #39 above. This has been an educational 9 hours learning more about drupal and drupal commerce.
Scott

Just putting a note in here to see if #727876: Enabling modules one at a time works differently than enabling them all at once has any bearing on this issue.

I really wanted to switch from Ubercart to Commerce, but this error is a deal-breaker. I've gotten it on clean installs both while enabling all Commerce modules at once, and while following the order in the Installation instructions. Everything seemed to be running smoothly until I got to Order and Order UI. Then I received the same "Recoverable fatal error" as in OP, #1, #20, #22, and #39.

If this is a clean install, is there any reason you can't just launch with Kickstart 1.x?

Status:Active» Fixed

Please apply a patch from #1509994: Missing entity property info results in notices / WSOD / fatal errors during installation.
That issue has similar symptoms and a patch which fixes them all.
Feel free to re-open if the problem persists after applying the patch.

Status:Fixed» Closed (duplicate)

If it's the same issue, then we should mark this one a duplicate. Feel free to re-activate if that turns out not to be the case.

The feedback from KarenS in #37 worked its way into a patch here: #1361562-21: Re-enabling Commerce causes a PHP Fatal Error

Will continue to pursue Staratel's fix in his linked issue.

For all who are using Windows Server. I'm using Server 2008r2 IIS7.

When I got this error my site was completely down.
I followed the instructions from #19 but I did not re-enable the modules. Just so I could open my site again.
I then followed the instructions from #40 under the EDIT: Found a solution for this! section. After doing that I didn't even have to re-enable the modules they were enabled automatically.

This may work for others on different platforms.

I recently got this fatal error in one of my sites. I used drush dis views -y to disable the views module to solve this issue. #40 to clear the cache is needed as well.

Issue summary:View changes

Do not do anything. Just copy the sites folder and paste to a new location. and re-install the drupal. Then replace the new sites folder with the old one. Dont forget to backup the database.

Thanks.

Many good comments. Seems issue starts for many reasons. Suspect that some recent Entity API changes are not tracked by other modules.

Drupal 7.26 install is using commerce-7.x-1.9. Module commerce_repair-7.x-1.x-dev did not fix.

Fix was manual disable of all commerce modules directly in database using PostgreSQL:

UPDATE system SET status=0 WHERE name LIKE 'commerce%';

And most important was removal of entity-7.x-1.4 module directory then roll back to entity-7.x-1.3. Running update.php between steps (clears cache?) Re-enable of commerce modules okay.