Just had a go with upgrading a Commerce shipping v1 with the Flat rate module to Shipping 2.0-dev and Flat rate 1.0-Beta1 and got this during update.php:

Update #7100
Failed: EntityMetadataWrapperException: Invalid data value given. Be sure it matches the required data type and format. in EntityMetadataWrapper->set() (line 122 of /var/www/zixiao-test.loc/html/sites/all/modules/contribs/entity/includes/entity.wrapper.inc).

It seems to be line 153 of commerce_shipping.install that is causing the issue:

$line_item_wrapper->commerce_shipping_service = $line_item_wrapper->commerce_shipping_method->value();

I'm guessing that commerce_shipping_method is expected but one of my line items does not have it set. Changing:

if (!$line_item_wrapper->commerce_shipping_service->value()) {

to

if (!$line_item_wrapper->commerce_shipping_service->value() && !is_null($line_item_wrapper->commerce_shipping_method->value())) {

allows the update to complete. I've not done any other testing so far.

I've attached a Drupal debug() dump of the $line_item just before the error occurs.

I know the flat rate does not upgrade and was just going to re-create those rules. If things do not work after that quick fix I'm just going to uninstall shipping and re-install and see how I get on there so probably won't be able to test any other fixes but thought it was worth passing the error message on.

Comments

googletorp’s picture

Status: Active » Postponed (maintainer needs more info)

Did you properly run update.php and what were the results?

magicmyth’s picture

Sorry if I was not clear. That error was from running "update.php". The result is explained in the report. I got a EntityMetadataWrapperException exception due to the Entity wrapper trying to access the data of an empty field. I can't tell you why that field had no data though. If it has happened to me though (two sites in development hit this issue) then it might occur for others. The fix I mentioned should help anyone through the issue.

googletorp’s picture

Status: Postponed (maintainer needs more info) » Closed (won't fix)

There might be some edge cases in the 1.x to 2.x upgrade - but I don't think it's feasible to try to make a work for all solution - since a lot of the data is store elsewhere which makes it quite hard to make a consistent way of upgrading. It would depend on the version of the especially rules and maybe also other modules.