Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment #1
3rdLOF CreditAttribution: 3rdLOF commentedI 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:
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.
Comment #2
rei CreditAttribution: rei commentedI also got this error when enabling the module
Comment #3
googletorp CreditAttribution: googletorp commentedYeah, 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.