First of all, I hope I'm not duplicating the issue, but I haven't found anything on this case yet.
Few days ago I have moved little site with Drupal Commerce on it. It appears that adding a product to cart throws notice error:
Notice: Only variables should be passed by reference w commerce_cart_product_add() (line 1342 from /var/www/d7/sites/all/modules/commerce/modules/cart/commerce_cart.module).
It is regular Add to cart button from Product Reference field in node, so no hacks or magic to ruin the code.
But since this site was moved to PHP7 server, I knew it has probably something to do with this fact.
Solution for this is easy - replacing clone($line_item) usage with variable with cloned object. I'm attaching small patch to fix this.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | commerce-cart_product_add_php7-2762907-5.patch | 682 bytes | smccabe |
Comments
Comment #2
smccabe commentedLooks good, confirmed same fix works locally. Setting to needs review to trigger testbot
Comment #3
smccabe commentedOh, patch wasn't in comment, won't trigger, uploading just to trigger, no changes.
Comment #5
smccabe commentedPatch was not made relative and didn't apply, rerolled with proper paths
Comment #6
fbailey commentedComment #7
smccabe commentedThe 2 fails in PHP7 are from ctools and are fixed in the dev release of ctools
Comment #8
tomrogThanks for quick testing ;)
Comment #9
rszrama commentedThanks guys! Committed.
Comment #12
howdytom commentedPatch #5 works for me.
Excellent. Thank you, smccabe
Comment #13
kevin morse commentedAny idea when this will be released?
Comment #14
wizonesolutionsEDIT: nevermind, I got my dates mixed up.
Yeah, this doesn't even seem to have appeared in the dev release? Strange.
Comment #15
gthing commentedThis is not fixed. I just did a clean install and ran into this error when trying to enable the cart module. I had to implement the fix myself.
Comment #16
rodrigoaguileraThere is no stable version with this fix. You will have to use a dev version until 1.14 is released
Comment #17
Kiendeleo commentedThis fix has still not been added to the current stable release.
Comment #18
crawley commentedThank you. The patch worked for me.
Comment #19
harefine commentedSorry, i ve the same problem - how can i add this patch?
Comment #20
Frank Panduh commentedAt Line # 1344 changed it to:
that seemed to make the error go away.
as seen here:
Notice: Only variables should be passed by reference in commerce_cart_product_add()
Comment #21
fonant commentedPatch works for me, is simple, and makes sense.
Comment #22
matas.k commented9 months still not in stable release...
Comment #23
agenciaq1 commentedHi,
The patch works for me.
Thank you,
Comment #24
jjmackow commentedconfirmed; altering line 1344 to
$tmp_line_item = clone($line_item);
drupal_alter('commerce_cart_product_comparison_properties', $comparison_properties, $tmp_line_item);
***
issue began to occur only after upgrading from PHP 7.0 to the latest PHP 7.1 and then having run cron on the drupal instance, commerce cart module had been running OK with PHP 7.0 ;
making the changes allowed me to run commerce cart with PHP 7.1
Comment #25
thomas.claes commentedI can confirm patch #5 is working. (tested on PHP 7.1.2)
Can a new 7.x-1.x version be created, please?
Comment #26
redeight commentedPatch #5 worked for me as well. Any word on when we'll get a stable release?
Comment #27
Bram Esposito commentedpatch #5 worked. A release would be appreciated.
Comment #28
gangwarsurya commentedThanks smccabe
Patch #5 Worked. I had applied this patch and work for me.
Comment #29
alislis commentedTested on PHP 7.1, D7 + Commerce.
Was an error on commerce_cart, and patch#5 worked for me, thanx.
Comment #30
erier commentedPatch #5 also worked for me. Whats taking so long on the stable release?
Comment #31
rszrama commentedIn short: #2697017: Revert the EntityFieldQuery based product matcher and arbitrary options list limit
Comment #32
ddhuri commentedThanks smccabe
Patch #5 Works for me.
Comment #33
nachus commentedSame error here, the patch works for me. Thanks!
Comment #34
kevster commentedMany thx - #5 helped fix my problem - error gone now!
Comment #35
forwardslashuser commented#5 worked for me. Thank you.
Comment #36
dunebl#5 solve my problem too
Comment #37
drupal-son commentedHi @rszrama,
I'm upgrading a website to PHP7.x (Drupal 7.59 and PHP 7.1) and updating commerce module from 7.x-1.13 to 7.x-1.14.
After updating the module, I've got a "FacesExtendableException: There is no method getElementName for this instance of the class RulesConditional. in /app/sites/all/modules/rules/includes/faces.inc:133" error and can't access rules and payment methods any more (WSOD).
Or when trying to clear caches.
Same happens using the latest 7.x-1.x-dev version.
If I rollback to version 7.x-1.13 and apply the patch #5 it works, but not on version 1.14 where the patch should be committed to.
Is it safe to stay in commerce 7.x-1.13 running PHP 7.1?
Any idea why the 7.x-1.14 version is not working?
Thanks.
Comment #38
kris77 commentedPatch #5 Works for me too.
Thanks @smccabe
Comment #39
jasonschweb commentedThis patch appears to have included in commerce 1.15 but not included on the release notes.
Comment #40
howdytom commented@ jasonschweb: Yes, Patch#5 has already been included in commerce 7.x-1.15. It's missing in the release notes.
Comment #41
suparnaa.dey commented#5 works for me
Comment #42
suparnaa.dey commented#5 works for me