Warning: __clone method called on non-object in commerce_cart_order_refresh() (line 791 of /home/.../modules/commerce/modules/cart/commerce_cart.module).
I get this error when a line item has been deleted from an order prior to the cart being viewed. checking the loop in the function I find that the line item that throws the error is set to NULL. It is removed from the order with $order_wrapper-line_items->offsetUnset(), the order is saved, and then the line item is deleted.
1. Are there clear instructions for properly removing a line item from an order to avoid the array object still having a NULL pointer for the key?
2. In the alternative can we add a not null conditional for the loop to avoid this error?
Comments
Comment #1
graker commentedI have the same error, on the sime line.
The issue appeared when user was trying to delete an entry from the cart, using Commerce Cart Ajax module. The ajax error was thrown and then the site gone BSOD with the error described by topic starter.
Comment #2
Everett Zufelt commentedI was actually testing on 7.x-1.2, I notice on 7.x-1.x that this is fixed. Can someone tell me whre I might find the patch of this change for use w/ drush make?
commerce-7.x-1.x: commerce_cart.module
Comment #3
Everett Zufelt commentedI found #1423204: Add some self healing for order line item references. Looks like it is dependent on an Entity module patch that just got committed 2 days ago. So, it's wait for releases or patch manually for now.