[Mon Sep 29 12:37:44 2014] [error] [client xxxxxxxxxxxx] PHP Fatal error: Can't use function return value in write context in /var/www/site/sites/all/modules/2235791/commerce_shipping_cd.module on line 198.

This is the error i get after using the last changes you made, just reporting the issue!

Best Regards!

Comments

badzpeed’s picture

Issue summary: View changes
kaido.toomingas’s picture

Hey how could I reproduce this? Please provide some steps.

badzpeed’s picture

I was using your module at the commit 3a3e6a3 on 7.x-1.x but there was a problem when a flat rate was empty it would throw one entity malfunction, then i saw the latest commit you made and i used it as a patch

From 6966a135dfea4db11016c0223dfa10a74e2ffc5c Mon Sep 17 00:00:00 2001
From: Kaido
Date: Thu, 25 Sep 2014 14:53:04 +0000
Subject: Fix entity error if no shipping profile is assocated with current shipping type

---
diff --git a/commerce_shipping_cd.module b/commerce_shipping_cd.module
index 107ee92..856dd07 100644
--- a/commerce_shipping_cd.module
+++ b/commerce_shipping_cd.module
@@ -195,7 +195,7 @@ function commerce_shipping_cd_commerce_checkout_complete($order) {
  */
 function commerce_shipping_cd_unset_unused_shipping_data($order, $service, $fields) {
   foreach($fields as $key => $field) {
-    if ($field != $fields[$service]) {
+    if ($field != $fields[$service] && !empty(variable_get($key . '_details_form'))) {
       $order->$field = NULL;
     }
   }
--
cgit v0.9.2

The steps i took were just use this patch and upload it to my site, then it stopped working every time i tried to checkout a product. Drupal just crashes and apache error log shows the error above. Could the problem originate from my side ?

kaido.toomingas’s picture

Yeah I noticed the problem allready there's function call inside emty()... Will fix it for the release and for you I can say the fix would be.
$service_details = variable_get($key . '_details_form');
if ($field != $fields[$service] && !empty($service_details)) {

kaido.toomingas’s picture

Status: Active » Fixed
Chithra K’s picture

Status: Fixed » Needs work

still getting the error
Fatal error: Can't use function return value in write context in /.. /sites/all/modules/contrib/commerce_shipping_cd/commerce_shipping_cd.module on line 198
while trying to enable this module for the first time.