I just upgraded from D6 to D7 and the product detail pages and catalog views are displaying this error:

Fatal error: __clone method called on non-object in 
\sites\all\modules\ubercart\uc_product\uc_product.module on line 638

The product edit page is fine, it's just the product detail page and and catalog view. Any idea what the problem may be and how to fix?

Thanks.

CommentFileSizeAuthor
#17 1443316-uc_product-variant-clone.patch776 byteslongwave

Comments

longwave’s picture

Status: Active » Postponed (maintainer needs more info)

Is this happening for all products or just one/some of them? Have you tried clearing caches to see if that fixes it?

The error suggests that a node is perhaps failing to load, but if you can successfully edit it I'm not sure why this would happen.

kruser’s picture

It's happening for all the products and the _catalog_grid and _catalog views. But it's interesting when I edit the views (ex admin/structure/views/view/uc_catalog/edit/catalog), I'm able to generate a working preview of the products in the catalog.

I cleared cache, but it didn't help.

longwave’s picture

Still not sure what would cause this. Do you have any other contrib modules enabled that affect Ubercart or nodes in general? Try turning them off to see if you can narrow down the problem.

longwave’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

Still not sure how this could happen, if you discover the cause or can provide more info please reopen this issue.

kruser’s picture

I have no idea. I ended up delete it all and starting from scratch. I'm guessing I messed up the migration somewhere.

dannieboi’s picture

Status: Closed (cannot reproduce) » Needs review

I am also getting this error.
This happens when I try upgrade ubercart from 7.x-3.0 rc3 to 7.x-3.0, (and even if I go from rc3 to rc4)
All the pages of my website are blank and I have to revert back to rc3.

Any ideas would be greatly appreciated.

tr’s picture

Category: bug » support
Status: Needs review » Postponed (maintainer needs more info)

"needs review" is only for when there's a patch attached to the issue.

@dannieboi: If you want help with this, you can start by answering the questions already asked above. You might also look in your error logs to see what's in there and post the error here. You might also look through the FAQs on drupal.org for how to deal with and fix problems that cause a blank white page (WSOD or "white screen of death"). Most likely, this is not an Ubercart problem.

tr’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

Closing again ...

bensey’s picture

I'm getting this error also. It's only doing it for user 1 (super admin), and any functions that call the cart trigger it.
The cart seems to work fine for other users.

From issue #1482044: Fatal error: __clone method called on non-object I'm wondering if it's the same problem:
"The only way this can happen is if the current in-checkout order is being deleted somehow."

This could make sense here, as it stands I can't call any functions to the user 1 cart, and can't view orders if what I'm guessing is the offending order is on the page.

longwave’s picture

Status: Closed (cannot reproduce) » Active
longwave’s picture

Please try upgrading to 7.x-3.x-dev and let us know if it is fixed there.

bensey’s picture

Well, my error has miraculously disappeared for user 1, go figure.
I was able to access old orders, and had found an order containing a product of a content type that had been deleted. Maybe this caused the problem, although as I was able to see the order with this defunct content type now. Mysterious.

Infuriatingly I'm now getting the same error message at the bottom of every single page (in plain text), just before the closing body tag.

It seems the function is being called on every single page, even just plain pages without any products being displayed, and is throwing the error each time.

Should _uc_product_get_variant be called on every single page load?

Tried upgrading to 7.x-3.x-dev to see if it happened to fix things but no luck.

bensey’s picture

I've just found that this is happening when cron runs, which it is set to every three hours by default, so it trying to run on every page load and failing. Turn off cron, no error. Run cron manually, total crash ending with _uc_product_get_variant() in the call stack.

I still suspect there is a dodgy item in the cart or an order perhaps, as user 1 cannot view cart without crash, whereas other users can...
I'm no expert, but does it look like it could be caused while trying to empty an expired cart with a dodgy item? Bottom of call stack is as follows:

9 0.3825 58021424 drupal_cron_run( ) ..\system.admin.inc:1604
10 24.7745 71409104 module_invoke( ) ..\common.inc:5121
11 24.7746 71409440 call_user_func_array ( ) ..\module.inc:795
12 24.7746 71409680 uc_cart_cron( ) ..\module.inc:0
13 24.7919 71413872 uc_cart_empty( ) ..\uc_cart.module:233
14 24.7960 71434752 entity_delete_multiple( ) ..\uc_cart.module:1257
15 24.7962 71436624 EntityAPIController->delete( ) ..\entity.module:229
16 24.7962 71436672 EntityAPIController->load( ) ..\entity.controller.inc:327
17 24.8009 71464808 UcCartItemController->attachLoad( ) ..\entity.controller.inc:244
18 24.8009 71464808 uc_product_load_variant( ) ..\uc_cart.controller.inc:11
19 24.8066 71466816 _uc_product_get_variant( ) ..\uc_product.module:678

bensey’s picture

Having set the cart to only expire in a really long time, cron now runs. Think it is the empty expired cart issue.
In fact have just gone into db and deleted all entries for user 1 in uc_cart_products and all errors have now gone.
Wish I had thought of doing that days ago before wasting all these hours!

bensey’s picture

Ok have just checked the node IDs of the products in user 1's cart and some of the nodes had been deleted.
This error seems to be caused by trying to create a variant of a non-existent node.

Could it be a good idea to incorporate a check in various cart functions to confirm that the node exists, and to automatically delete the item from the cart if it doesn't?

Anonymous’s picture

Version: 7.x-3.0 » 7.x-3.1
Category: support » bug

I had exact same issue. And it was exactly because of what bensey described above.

I had a product in the cart of my admin user and I deleted that product. After that the site became more or less unusable for my admin user since when trying to do anything it kept erroring out.
Manually removing the broken item from uc_cart_products table fixed the issue.

Thanks bensey for finding this out for us.

longwave’s picture

Status: Active » Needs review
StatusFileSize
new776 bytes

Can someone who is affected by this please test the attached patch?

mattian’s picture

thank you so much, i have cleared data into "uc_cart_products" table and the problem was fixed!

longwave’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

missed the catalog view page too