I tried debugging a bit and found the problem on this line of uc_cart_get_contents():


    // Allow other modules a chance to alter the fully loaded cart object.
    drupal_alter('uc_cart', $items[$cid]);

right before that script executes succesfully (tried it with a die(var_dump(1));)
but after that there is nothing.

browser's response: (chrome)

No data received
Unable to load the webpage because the server sent no data.

My guess:
Maybe because $items[$cid] is NULL?

CommentFileSizeAuthor
#10 1410452-alter-empty-cart.patch453 byteswodenx
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

longwave’s picture

Status: Active » Postponed (maintainer needs more info)

Can't reproduce this with a quick test, and the entire checkout process is covered by a SimpleTest, which also works. The line you have identified has been in uc_cart_get_contents() for some time.

What payment method are you using to test with? Do you have any contrib modules installed, specifically ones that might implement hook_uc_cart_alter()? (perhaps it is failing during the alter for some other reason) Do you have any errors in your server error log? (it's also strange that you get no output at all)

ParisLiakos’s picture

Status: Postponed (maintainer needs more info) » Active

Yes,thanks for the info,i guess that some other module implements the hook and breaks everything..i have no idea why i have no output on browser.the weird thing is that there is no php notice or warning in the reports and everything was fine with rc3.

i will check each hook_uc_cart_alter implementation and get back to if i some of my custom code didnt break it.

thanks longwave

ParisLiakos’s picture

Status: Active » Postponed (maintainer needs more info)

oops sorry for status change

ParisLiakos’s picture

ok i kept debugging in drupal_alter.the only module that implements it is uc_quote with uc_quote_uc_cart_alter which calls uc_coupon_session_validate which in turn calls uc_cart_get_contents again..maybe its looping endlessly?

if i set $items[$cid] as array() before drupal_alter() everything works just fine.

ParisLiakos’s picture

Status: Postponed (maintainer needs more info) » Active

Hmm yes it is.i added watchdog('alter', REQUEST_TIME) right before drupal_alter and i got about 100 entries in dblog..
so,i am reopening this

wodenx’s picture

Does everything work if you disable uc_coupon? If so, this should be moved to the uc_coupon queue - I haven't yet had a chance to fully test uc_coupon with the latest ubercart -dev.

ParisLiakos’s picture

Project: Ubercart » Ubercart Discount Coupons
Version: 7.x-3.x-dev » 7.x-2.1-alpha4
Component: Cart/checkout » Code

Yes,disabling uc_coupons solve the problem..moving the issue there

wodenx’s picture

Status: Active » Postponed (maintainer needs more info)

I can't reproduce on my end. uc_coupon_session_validate() only calls uc_cart_get_contents() when no products are supplied. Do any of your custom modules implement any of the following uc_coupon hooks:
hook_uc_coupon_revalidate
hook_uc_coupon_validate
hook_uc_coupon_apply
hook_uc_coupon_remove

or do you have uc_coupon_workflow enabled, and active rules which respond to any of the following events:
'check for automatic discounts'
'a valid discount coupon is applied'
'a valid discount coupon is removed'

ParisLiakos’s picture

nope,i dont use coupons at all..it was enabled because i forgot i had it enabled just to check it out..did you try it with latest ubercart dev version?
it was working fine with rc3.I used bank transfer as payment method.(if that helps)

wodenx’s picture

Status: Postponed (maintainer needs more info) » Needs review
FileSize
453 bytes

Hang on - this may be an ubercart issue after all. Can you apply this patch (to ubercart) and see if the problem persists?

ParisLiakos’s picture

Project: Ubercart Discount Coupons » Ubercart
Version: 7.x-2.1-alpha4 » 7.x-3.x-dev
Status: Needs review » Reviewed & tested by the community

yes it works with this patch..i should transfer the issue back to ubercart then?

wodenx’s picture

This is definitely an Ubercart bug - the new 'empty' op to uc_cart_get_contents() - designed to avoid rebuilding the cart when it was known to be empty - sometimes causes hook_uc_cart_alter() to be invoked with a NULL argument. Patch at #10 fixes it.

longwave’s picture

Status: Reviewed & tested by the community » Fixed

Committed

Status: Fixed » Closed (fixed)

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

Anonymous’s picture

Issue summary: View changes

added guess

solarDog’s picture

I am not sure if my issue applies here but, when updating Ubercart 7.x - 3.6 I get this in Chrome: "No Data received" (Unable to load the webpage because the server sent no data.
Error code: ERR_EMPTY_RESPONSE)

I have not been able to find a similar issue relating to this latest Ubercart release. ( 7.x - 3.6)

Reading the above comments suggests that this may be an Ubercart issue though it seems that it could also be another module conflict.

Any help would be much appreciated.

solarDog’s picture

Scratch my last post... Updating the database fixed it and feeling rather sheepish.