Hello,

After update PHP 7.0 to PHP 7.1, I get this error each time I do a "drush cc all" or when the cron start...
PHP Fatal error: Only variables can be passed by reference in /home/sites/drupal-7/sites/all/modules/commerce/modules/cart/commerce_cart.module on line 1344

Do you have a cure?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

steveoriol created an issue. See original summary.

steveoriol’s picture

Priority: Major » Normal
Status: Active » Needs review

Oddly, I wanted to test out the "clone" function of the parameters, and by a miracle, the error disappeared ;-) I do not know why, but it's cool.

Before:

    // Allow other modules to specify what properties should be compared when
    // determining whether or not to combine line items.
    drupal_alter('commerce_cart_product_comparison_properties', $comparison_properties, clone($line_item));

After:

    // Allow other modules to specify what properties should be compared when
    // determining whether or not to combine line items.
    $cloned_lineitem = clone($line_item);
    drupal_alter('commerce_cart_product_comparison_properties', $comparison_properties, $cloned_lineitem);
bojanz’s picture

Do note that PHP 7.1.0 has a critical regression that actually fails Drupal 8 tests, people were told to not use PHP 7.1 until 7.1.1 is released.

I don't know if that's related to this issue though.

paintingguy’s picture

I cannot log into the admin/config with php 7.1. Any suggestions?

steveoriol’s picture

@paintingguy,
my PHP version for apache2 is still 7.0.
my problem was the PHP (cli) version, it's now 7.1 on an the ubuntu server 16.04. So I guess I only had problem when a use the drush command...

If you are on ubuntu like you can switch the version of PHP by set the php alternative:

steve@nsxxxxxx:~⟫ php -v
PHP 7.1.0-5+deb.sury.org~xenial+1 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.1.0-dev, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.1.0-5+deb.sury.org~xenial+1, Copyright (c) 1999-2016, by Zend Technologies
steve@nsxxxxxx:~⟫ sudo update-alternatives --set php $(sudo update-alternatives --list php | grep "php7.0")
update-alternatives: utilisation de « /usr/bin/php7.0 » pour fournir « /usr/bin/php » (php) en mode manuel
steve@nsxxxxxx:~⟫ php -v
PHP 7.0.14-2+deb.sury.org~xenial+1 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.14-2+deb.sury.org~xenial+1, Copyright (c) 1999-2016, by Zend Technologie
steve@nsxxxxxx:~⟫ sudo update-alternatives --set php $(sudo update-alternatives --list php | grep "php7.1")
update-alternatives: utilisation de « /usr/bin/php7.1 » pour fournir « /usr/bin/php » (php) en mode manuel
steve@nsxxxxxx:~⟫ php -v
PHP 7.1.0-5+deb.sury.org~xenial+1 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.1.0-dev, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.1.0-5+deb.sury.org~xenial+1, Copyright (c) 1999-2016, by Zend Technologies
Charlotte17’s picture

Status: Needs review » Needs work

The last submitted patch, 6: allow_combine_line_items-2844108-6.patch, failed testing.

joshmiller’s picture

Status: Needs work » Needs review
FileSize
865 bytes

Had the same problem. While yes, I believe we should follow the recommended strategy of PHP 7.0, I also don't see why this change would be outright rejected.

Tested the patch and it needs to be made from within the commerce directory.

Attached is the updated patch.

Status: Needs review » Needs work

The last submitted patch, 8: allow_combine_line_items-2844108-7.patch, failed testing.

Charlotte17’s picture

@joshmiller Exactly, what did you do in your patch update?

joshmiller’s picture

--- a/sites/all/modules/commerce/modules/cart/commerce_cart.module
+++ b/sites/all/modules/commerce/modules/cart/commerce_cart.module

From this ^

--- a/commerce/modules/cart/commerce_cart.module
+++ b/commerce/modules/cart/commerce_cart.module

To this ^

EDIT: Though, it appears it's failing because it doesn't apply, so maybe it just needs a re-roll. Applied for me just fine.

joshmiller’s picture

You know what, I think I didn't go deep enough ... the patch shouldn't have commerce in the path.

Attached one more try.

joshmiller’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 12: allow_combine_line_items-2844108-8.patch, failed testing.

Charlotte17’s picture

@joshmiller Thanks, I was working on local project!

tuutti’s picture

The patch does not apply against 7.x-1.x because this seems to be fixed already on the 7.x-1.x branch (http://cgit.drupalcode.org/commerce/commit/modules/cart/commerce_cart.mo...) or am I missing something?

Berdir’s picture

Status: Needs work » Closed (duplicate)

Confirmed, this seems to have been fixed elsewhere in 7.x-1.x-dev.

Berdir’s picture