Upgrade via Drush:

Fatal error: Can't use method return value in write context in /var/www/drupal/sites/all/modules/contrib/commerce_shipping/commerce_shipping.install on line 152

Error: Can't use method return value in write context in /var/www/drupal/sites/all/modules/contrib/commerce_shipping/commerce_shipping.install, line 152

Any ideas

Comments

3rdLOF’s picture

Status: Active » Needs work

I got temporary workaorund for this problem so I could get the site back up and running. Basically on line 153 of commerce_shipping.install empty appears to be used improperly according the PHP.net manual (http://us3.php.net/empty):

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

So I modified the code by adding a variable declaration to collect the contents, then called it like so:

$emptycheck = $line_item_wrapper->commerce_shipping_service->value();
if (empty($emptycheck)) {

I made no patch because I have no idea if this is the correct approach, but the error disappeared and the install process did complete. So far no problems I can see.

Please check this. This is only a temporary patch because this error WOD'ed everything...even Drush.

rei’s picture

I also got this error when enabling the module

googletorp’s picture

Status: Needs work » Fixed

Yeah, this is my bad. Sometimes I forget you can't use wrapper values with empty

Anyways, I replaced empty with ! and pushed the fix to the 2.x branch.

Status: Fixed » Closed (fixed)

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