Drupal 7 error on PHP 7: Fatal error: Only variables can be passed by reference in C:\xampp\htdocs\helpmatepools\sites\all\modules\commerce\modules\cart\commerce_cart.module on line 1344
A common error on Drupal 7 running on PHP 7: Fatal error: Only variables can be passed by reference in C:\xampp\htdocs\xxx\sites\all\modules\commerce\modules\cart\commerce_cart.module on line 1344
- Ensure Drupal is updated to latest stable version (as of posting: Drupal 7.56)
- Install Ctools dev version (as of posting: ctools 7.x-1.x-dev) https://www.drupal.org/project/ctools/releases/7.x-1.x-dev
This will fix a related error:
Deprecated function: Methods with the same name as their class will not be constructors in a future version of PHP; ctools_context has a deprecated constructor in require_once() (line 113 of C:\xampp\htdocs\xxx\sites\all\modules\ctools\ctools.module).
- Apply patch for Drupal Commerce and Commerce Cart module as discussed here - https://www.drupal.org/node/2762907
- You may also need to check a related patch for Drupal Commerce Shipment module as discussed here - https://www.drupal.org/node/2695493